function escapeRegExp(s) {
    return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
}
Escapes special characters in string s such that the string
can be used in `new RegExp`. For example "[" becomes "\\[".

@param {string} s Regex string.
@return {string} Escaped string.