function escapePattern(pattern) {
  return pattern.replace(/\\/g, '\\\\');
}
Escape regular expression pattern by making the following replacements:
 * single backslash -> double backslash
@param {string} pattern
@returns {string}