REGEX working in chrome but breaks in safari


The following javascript regex breaks in safari getting SyntaxError: Invalid regular expression: invalid group specifier name"


Can someone please help me to re write the regex which can work in safari?

I find out that safari doesn’t support lookbehind but still not able to re write the whole regex which can be good for safari.

>Solution :

Modify your pattern to avoid the negative lookbehind. Since you seem to want a non whitespace character as the last character, just use a character class for that.


Side note: your current pattern looks wrong for what you are trying to match.

Leave a Reply Cancel reply