0

So I have this regular expression...

(?i)\b[p]*(ost)*\.*\s*[o]*(ffice)*\.*(?<=po|p.o|o\.|office|post)\s*[b][o][x]\b|(?<=\d\s|^)\s*[[b][o][x]]*(?!\s*[a-z])|(?<=\d\s|^)\s*[[p][o]]*(?!\s*[a-z])

If you look at regex101.com and run the unit tests in PHP you can see all the tests match.

enter image description here

However, that same regex fails in JS.

enter image description here

Seems to be an issue with the first ? and possibly the use of look-backs? I might as well be looking at Japanese.

Is there an easy way to make this regex compatible with JS?

RiddleMeThis
  • 1,345
  • 4
  • 16
  • 29

0 Answers0