code: function tryCreateRegexp(src, flags, throwErrorAt, parser) {
    try {
      return new RegExp(src, flags);
    } catch (e) {
      if (throwErrorAt !== undefined) {
        if (e instanceof SyntaxError) parser.raise(throwErrorAt, "Error parsing regular expression: " + e.message);
        throw e;
      }
    }
  }
docs: Parse a regular expression. Some context-awareness is necessary, since a '/' inside a '[]' set does not end the expression.