SyntaxError: Invalid regular expression: invalid group specifier name
See original GitHub issueHey, I’m getting this error here on iOS and macOS Safari:
SyntaxError: Invalid regular expression: invalid group specifier name
It comes from here:
// Remove duplicate slashes if not preceded by a protocol
if (urlObj.pathname) {
urlObj.pathname = urlObj.pathname.replace(/(?<!https?:)\/{2,}/g, '/');
}
My code: https://github.com/muuvmuuv/portfolio/blob/master/src/elements/Link.jsx Live error: https://portfolio-git-development.muuvmuuv.now.sh/
I am using version 5.x
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:36 (7 by maintainers)
Top Results From Across the Web
Works in Chrome, but breaks in Safari: Invalid regular ...
I had the same issue, and it turned out to be a RegEx expression in one of my dependencies, namely Discord.js .
Read more >SyntaxError: Invalid regular expression: invalid group ... - GitHub
I think this error is due to the fact that Safari does not support the "lookbehind" in regex. SyntaxError: Invalid regular expression: invalid...
Read more >Safari will not load React App. Invalid regular expression
The error concern "Invalid regular expression: invalid group specifier name". A google search revealed that Safari does not support all ...
Read more >Angular SyntaxError - Apple Developer
Angular SyntaxError: SyntaxError: Invalid regular expression: invalid group specifier name. ... Ideally I would like to see the regex that causing this.
Read more >SyntaxError: invalid regular expression flag "x" - MDN Web Docs
The JavaScript exception "invalid regular expression flag" occurs when the flags in a regular expression contain any flag that is not one ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey, I’m coming from Gatsby, thanks a lot for this issue. As mentioned above, it’s a critical issue.
And this has been open for a while. Any Idea why there hasn’t been any progress on something that seems like a simple syntax error?
Thanks
Fixed in https://github.com/sindresorhus/normalize-url/releases/tag/v7.0.1