awaters8
asked on
Javascript RegEx failing....
i am using a regex in Javascript and keep getting an error. I have used the same regex on several tester sites andthe parse works fine. I can't figure out hwy it isn't working my implementation.
Here is the code snippet:
var re = /^((?<!P\.?\s?O\.?\sBox).) +(?<!P\.?\ s?O\.?\sBo x)$/i;
alert("??"+re.Exec(documen t.register form.b_add ress.value ));
It doesn't get to the alert before Firefox throws this error:
Error: invalid quantifier ?<!P\.?\s?O\.?\sBox).)+(?< !P\.?\s?O\ .?\sBox)$
Source File: ...
Source Code:
var re = /^((?<!P\.?\s?O\.?\sBox).) +(?<!P\.?\ s?O\.?\sBo x)$/i;
Thoughts?
Here is the code snippet:
var re = /^((?<!P\.?\s?O\.?\sBox).)
alert("??"+re.Exec(documen
It doesn't get to the alert before Firefox throws this error:
Error: invalid quantifier ?<!P\.?\s?O\.?\sBox).)+(?<
Source File: ...
Source Code:
var re = /^((?<!P\.?\s?O\.?\sBox).)
Thoughts?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the quick response!
Thanks for the question and the points.
Doesn't /^((?!P\.?\s?O\.?\sBox).)+ $/i do he same thing?
ASKER
It does...I'll report back if any of my test cases fail.
ASKER