question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

safari 13 regExp error with flags u

See original GitHub issue

there is an error on safari 13 : SyntaxError: Invalid regular expression: invalid escaped character for unicode pattern
And it will not happend on safari14.

I found it caused by
node_modules/monaco-editor/dev/vs/editor/editor.main.js line 104281

.replace(/([^\b_])(\p{Lu})(\p{Ll})/gmu, '$1_$2$3')

It look like a safari’s error, but I have no documents to prove it. Can somebody tell me how to resolve it? Or give me some safari’s documents?(I found nothing useful on Apple’s website)
Thx very much.

**monaco-editor version: 0.22.0 or 0.22.3 Browser: safari13 **OS:**10.15.7 Playground code that reproduces the issue:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
alexdimacommented, May 12, 2021

I’ve pushed another change to protect against this. The outcome of this last change is that SnakeCaseAction will simply not be available in Safari 13, but I could not test it since I have Safari 14.

3reactions
SamVerschuerencommented, Apr 13, 2021

This will highly likely not fix it entirely. The Monaco editor has two regexes which need replacement and only then it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
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 >
NSRegularExpression | Apple Developer Documentation
An immutable representation of a compiled regular expression that you apply to Unicode strings. iOS 4.0+ iPadOS 4.0+ macOS 10.7+ Mac Catalyst 13.1+...
Read more >
New JavaScript Features That Will Change How You Write ...
Regular expressions have been part of the JavaScript language since the ... Lookbehind assertions; Named capture groups; s ( dotAll ) Flag ......
Read more >
require-unicode-regexp - ESLint - Pluggable JavaScript Linter
The u flag disables the recovering logic Annex B defined. As a result, you can find errors early. This is similar to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found