microsoft / microsoft/monaco-editor

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

Open
#4,557 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/vs/editor/common/services/findSectionHeaders.ts, around line 39, where the /d regular-expression modifier is used, and review the related issue #2345. Confirm the compatibility behavior in Safari 14; done means the editor no longer fails with an invalid-regexp-flags error there.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.