Skip to content

Regular Expression Guide, page on Groups and Backreferences: "Types" section suggests wrong syntax for "Modifier" ("local flags") #42609

@rpbouman

Description

@rpbouman

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Groups_and_backreferences#types

What specific section or headline is this issue about?

anchor: #types, heading text: "Types"

What information was incorrect, unhelpful, or incomplete?

The Types section provides a table listing all the different group types, along with their name and a link to details about the type.
The 4th row reads:

(?flags:x), (?:flags-flags:x) | Modifier: Enables or disables the specified flags only to the enclosed pattern. Only the i, m, and s flags can be used in a modifier.

What did you expect to see?

The link to the Modifier leads to:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Modifier

on that page the syntax is given as:

(?flags1:pattern)
(?flags1-flags2:pattern)

It seems that the syntax given in the main page:

(?:flags-flags:x)

is wrong - first colon should not be there.

Do you have any supporting links, references, or citations?

Yes, the page that is linked to gives the Modifier syntax:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Modifier

which does not match the syntax given in the main page.

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Content:JSJavaScript docsgood first issueA good issue for newcomers to get started with.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions