• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

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\.?\sBox)$/i;
      alert("??"+re.Exec(document.registerform.b_address.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\.?\sBox)$/i;

Thoughts?
0
awaters8
Asked:
awaters8
  • 3
  • 3
1 Solution
 
ddrudikCommented:
JS doesn't support ?<= or ?<! constructs.
0
 
awaters8Author Commented:
Bummer...Is there a way to accomplish a negative look back in JS?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
awaters8Author Commented:
Thanks for the quick response!
0
 
ddrudikCommented:
Thanks for the question and the points.
0
 
ozoCommented:
Doesn't /^((?!P\.?\s?O\.?\sBox).)+$/i do he same thing?
0
 
awaters8Author Commented:
It does...I'll report back if any of my test cases fail.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now