2.1.137 [ECMA-262-1999] Section 15.10.4.1, new RegExp (pattern, flags)

V0203:

If pattern is an object R whose [[Class]] property is "RegExp" and flags is undefined, then let P be the pattern used to construct R and let F be the flags used to construct R. If pattern is an object R whose [[Class]] property is "RegExp" and flags is not undefined, then throw a #TypeError# __RegExpError__ exception. Otherwise, let P be the empty string if pattern is undefined and ToString(pattern) otherwise, and let F be the empty string if flags is undefined and ToString(flags) otherwise.

V0204:

If F contains any character other than "g", "i", or "m", #or if it contains the same one more than once,# then throw a #SyntaxError# __RegExpError__ exception.

V0205:

If P's characters do not have the form Pattern, then throw a #SyntaxError# __RegExpError__ exception. Otherwise let the newly constructed object have a [[Match]] property obtained by evaluating ("compiling") Pattern. Note that evaluating Pattern may throw a #SyntaxError# __RegExpError__ exception. (Note: if pattern is a StringLiteral, the usual escape sequence substitutions are performed before the string is processed by RegExp. If pattern must contain an escape sequence to be recognised by RegExp, the "\" character must be escaped within the StringLiteral to prevent its being removed when the contents of the StringLiteral are formed.)

V0206:

The source property of the newly constructed object is set to an implementation-defined string value in the form of a Pattern based on P.

For JScript 5.x, when pattern is an object R whose [[Class]] property is RegExp the source property of the newly constructed object is set to the same string value as the value of the source property of pattern. Otherwise, the source property of the newly constructed object is set to P.