code: function escapeRegexString(unescapedString, escapeCharsRegex) {
      // Validate arguments.
      if (Object.prototype.toString.call(unescapedString) !== '[object String]') {
          throw new TypeError('Argument 1 should be a string.');
      }
      if (escapeCharsRegex === undefined) {
          escapeCharsRegex = defaultEscapeCharsRegex;
      } else if (Object.prototype.toString.call(escapeCharsRegex) !== '[object RegExp]') {
          throw new TypeError('Argument 2 should be a RegExp object.');
      }
  
      // Escape the string.
      return unescapedString.replace(escapeCharsRegex, '\\$&');
  }
docs: Escape a string literal for use as an argument in the standard RegExp constructor.
  @alias module:escape-regex-string
  @param {string} unescapedString - The string containing a regex pattern to be escaped.
  @param {RegExp} [escapeCharsRegex] - An optional RegEx pattern containing a set of characters to escape. If not
  passed, value will be set to default.
  @return {string} - The escaped regex pattern string.
  @throws {TypeError} - Arguments must be correct type.
  @property {RegExp} defaultEscapeCharsRegex - A read-only property that contains the default escape character RegExp
  instance. The value of this property is the value used when the optional second argument is omitted in a call to
  {@link module:escape-regex-string}.