royale-compiler
royale-compiler copied to clipboard
Invalid Regex Flag x
-
var regex : RegExp = /[\s*]+/gx;
-
var regex : RegExp = /[\s*]+/g;
The x flag is legal in AS3 but not in js, so the first line should probably yield be a compile time error.
I thought I remember the x is rewritten?
Not in what I saw... I'll try to come up with a test case when I find the time.
new RegExp("a | b", "gx")
produces this runtime error:
Uncaught SyntaxError: invalid regular expression flag x
The x is extended syntax, to allow spaces to be in the expression for readability purposes. The spaces are ignored, unless preceded by a backslash (\).