Javascript RegExp Producing Unusual Results with Global Modifer

RamboBambio

New Member
I was able to work around this issue as it turned out I didn't need /g. But I was wondering if anyone would be able to explain why the following behavior occurred.\[code\]x = RegExp( "w", "gi" )x.test( "Women" ) = truex.test( "Women" ) = false\[/code\]It would continue to alternate between true and false when evaluating the expression. Which was an issue because I was using the same compiled RegExp on a list of strings, leading some to evaluate to false when they should have been true.
 
Top