Skip to content

RegexOptions.ECMAScript information is incomplete and outdated #11793

@rjgotten

Description

@rjgotten

Type of issue

Missing information

Description

The documentation for RegexOptions.ECMAScript states that it:

Enables ECMAScript-compliant behavior for the expression.

And refers to ECMAScript matching behavior for further information.

RegexOptions.ECMAScript is claimed to be ECMAScript-compliant by not supporting Unicode and thus character classes such as \p do not work in that mode. However, ECMAScript actually supports Unicode features just fine if a regex is created with the u flag, which has been in the ECMAScript specifications since ECMAScript 2015 and has been broadly supported in all major runtimes including desktop browsers, mobile browsers, and Node.js since 2016.

The documentation should at the very least be updated to reflect that RegexOptions.ECMAScript refers to decade-old legacy versions of ECMAScript.

(Better would be — should ECMAScript compliant behavior and parity still be taken seriously — to also follow up on this with actually implementing a series of RegexOptions.ECMAScript#### flag values corresponding to different specification levels that added relevant features. Esp. relevant for \p as the actual supported syntax is different and e.g. \p{Script=Latin} from ECMAScript, is not supported in C# regexes.)

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regexoptions?view=net-9.0

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Text.RegularExpressions/RegexOptions.xml

Document Version Independent Id

5eff3422-c906-6e35-23f2-24edc9a7310e

Platform Id

bc8182f4-183a-6849-5eb6-439c00944e30

Article author

@dotnet-bot

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions