simpler escapeRegExp

No behavior change, just a simpler way of implementing `escapeRegExp`.