Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky #3887

@fireattack

Description

@fireattack

Request type

  • Please close this issue, I accidentally submitted it without adding any details
  • New documentation
  • Correction or update

Details

It says

A regular expression defined as both sticky and global ignores the global flag.

But this doesn't seem to match my observation.

console.log('##-#'.replace(RegExp('#', 'gy'), 'x'));
console.log('##-#'.replace(RegExp('#', 'y'), 'x'));
console.log('##-#'.replace(RegExp('#', 'g'), 'x'));

The above all have different behaviors:

xx-#
x#-#
xx-x

(And they're as expected.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    30 minute taskThis is a fairly quick issue to fix, estimated time 30 minutes.Content:JSThis is related to JavaScript content

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions