dotnet / dotnet/dotnet-api-docs
RegexOptions.ECMAScript information is incomplete and outdated
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### 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](https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-options#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
Contributor guide
Assessment
This issue has not been assessed yet.