Tag Archives: safari

[Solved] SyntaxError: Invalid regular expression: invalid group specifier name

SyntaxError: Invalid regular expression: invalid group specifier name

Regular problem

SafariSyntaxError: Invalid regular expression: invalid group specification name
FirefoxSyntaxError: invalid regexp group
Mobile terminal: Android is normal, iOS is not

reason

Firefox, IE, and IOS do not support the following writing methods: ?<=, ?<!, ?!, ?=

Look ahead is a kind of conditional judgment, such as if statement
(?=exp) the position that satisfies expression exp after positive look ahead match
(?!exp) the position that does not satisfy expression exp after negative look ahead match

Solution:

let reg = /ab?<=cd/
Modify to
let reg = new RegExp('ab(?<=cd)')

Chrome Error: Uncaught Error: SECURITY_ERR: DOM Exception 18

Uncaught Error: SECURITY_ERR: DOM Exception 18

Question:
I get the following error in Chrome’s developer tools window when I try to set a cookie using this jQuery plugin:

Uncaught Error: SECURITY_ERR: DOM Exception 18

What does this error mean and how can I fix it? I get the same error when I use this jQuery plugin.

Answer:
You’re most likely using this on a local file over the file://URI scheme, which cannot have cookies set. Put it on a local server so you can use http://localhost.