Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid regular expression on Safari iOS < 16.4 #142

Open
sebamarynissen opened this issue Aug 1, 2023 · 6 comments · May be fixed by #146
Open

Invalid regular expression on Safari iOS < 16.4 #142

sebamarynissen opened this issue Aug 1, 2023 · 6 comments · May be fixed by #146

Comments

@sebamarynissen
Copy link
Contributor

I've noticed that anchorme v3 doesn't work anymore on Safari iOS < 16.4. It throws an error

Invalid regular expression: invalid group specifier name

I've done some debugging and found that the reason is this line

exports.final = "(?<=\\b|_)((".concat(exports.email, ")|(").concat(exports.file, ")|(").concat(exports.url, "))(\\b)?");

in the file regex.js because Safari doesn't support positive lookaheads below version 16.4: https://caniuse.com/js-regexp-lookbehind

I'm not sure why this positive lookbehind was added, but I propose to do something like

try {
  exports.final = "(?<=\\b|_)((".concat(exports.email, ")|(").concat(exports.file, ")|(").concat(exports.url, "))(\\b)?");
} catch (e) {
  exports.final = "\\b((".concat(exports.email, ")|(").concat(exports.file, ")|(").concat(exports.url, "))(\\b)?");
}

to be fail-safe.

@graux
Copy link

graux commented Aug 21, 2023

we are having this problem in production now... very difficult to replicate.

@o-alexandrov
Copy link

Duplicate of #133

@tibormarias
Copy link

tibormarias commented Nov 28, 2023

We had problems with this in a Laravel Mix + Vue app where in production several users (mostly iOS and maybe MacOS too) had blank page issues and we couldn't figure it out until we removed this package. We always thought it was some magic caching issue because only 2% of users had this issue.

@p29hieu
Copy link

p29hieu commented Dec 9, 2023

Do we have any update for now?

@rhysburnie
Copy link

I auto posted this from patch-package wiithout seeing this issue. #143

Similar propsed fix as above however I dont see how that try would work without attempting an actual regexp construction
its working for our porposes

@alexcorvi
Copy link
Owner

Please check the latest version 3.0.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants