SyntaxError: Invalid regular expression: invalid group specifier name

created at 10-16-2021 views: 1

This is because the Safari browser does not support two // regular expression zero-degree assertions in the format: ?\<=, ?\<!

solve:

Use constructor instead of // format

// change 
let reg = /ab?<=cd/
// to
let reg = new RegExp('ab(?<=cd)')
Please log in to leave a comment.