This would remove leading or trailing spaces, on the line before `Utils.escapeRegex(input.replace(/^\s+|\s+$/g,''))` would work just as well I would think, potentially 2 less function calls for the cost of one regexp replace, probably insignificant.