microsoft / monaco-editor

A browser based code editor
https://microsoft.github.io/monaco-editor/
MIT License
39.78k stars 3.55k forks source link

[Bug] The RegExp d Modifier was not support on Safari 14 const markRegex = /\bMARK:\s*(.*)$/d; #4557

Open XueMeijing opened 2 months ago

XueMeijing commented 2 months ago

Reproducible in vscode.dev or in VS Code Desktop?

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

Reproduction Steps

This website https://vscode.dev can't open at Safari 14 either, I can't test if it is Reproducible, so i just describe what the problem is.

I encountered an error on Safari 14 while using "monaco-editor": "^0.48.0". The error message is: Invalid regular expression: invalid flags

The error occurs at the following line of code:

const markRegex = /\bMARK:\s*(.*)$/d;

It appears similar to the issue reported at #2345.

You can find the specific line causing the error in the VSCode repository line 39: https://github.com/microsoft/vscode/blob/5ae5a741bdb676abb667fd4896dc2a40e313db3a/src/vs/editor/common/services/findSectionHeaders.ts#L39

image

Environment monaco-editor version: ^0.48.0 Browser: Safari 14

Additional Information According to the W3Schools documentation, the /d modifier was introduced in ES2022. It seems this modifier is not supported in Safari 14.

Could you provide a workaround or a fix for this issue?

Actual (Problematic) Behavior

No response

Expected Behavior

No response

Additional Context

No response

kagaricyan commented 2 months ago

same, I downgrade to 0.47.0 that works fine