Skip to content

Add RegexOptions.AnyNewLine documentation#12405

Closed
danmoseley wants to merge 2 commits intodotnet:mainfrom
danmoseley:anynewline-api
Closed

Add RegexOptions.AnyNewLine documentation#12405
danmoseley wants to merge 2 commits intodotnet:mainfrom
danmoseley:anynewline-api

Conversation

@danmoseley
Copy link
Member

@danmoseley danmoseley commented Mar 17, 2026

Add API documentation for the new RegexOptions.AnyNewLine enum member (value 2048), shipping in .NET 11 Preview 3.

AnyNewLine makes ^, $, \Z, and . recognize all Unicode newline sequences (\r\n, \r, \n, \u0085, \u2028, \u2029) instead of only \n. This addresses one of the most common pitfalls with System.Text.RegularExpressions -- that $ doesn't match before \r\n and . matches \r.

Related:

Add documentation for the new AnyNewLine enum member (value 2048)
that makes ^, $, \Z, and . recognize all Unicode newline sequences.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@danmoseley danmoseley requested a review from a team as a code owner March 17, 2026 04:28
Copilot AI review requested due to automatic review settings March 17, 2026 04:28
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds API reference documentation for the new RegexOptions.AnyNewLine enum member introduced in .NET 11, describing how it changes newline handling for anchors and ..

Changes:

  • Documented the RegexOptions.AnyNewLine enum member (value 2048).
  • Included behavioral details (supported newline sequences) and noted incompatibilities with NonBacktracking and ECMAScript.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@danmoseley
Copy link
Member Author

@gewarren can we merge? then I guess dotnet/docs#52328 will be green.

@gewarren
Copy link
Contributor

@danmoseley Is this for Preview 3? Normally we don't manually add docs like this. The CI imports it automatically.

@danmoseley
Copy link
Member Author

Ah! I didn't know that. I guess dotnet/docs#52328 should sit for a month or so then?

@danmoseley danmoseley closed this Mar 18, 2026
@danmoseley danmoseley deleted the anynewline-api branch March 18, 2026 18:07
@gewarren
Copy link
Contributor

Ah! I didn't know that. I guess dotnet/docs#52328 should sit for a month or so then?

Yes, that would be best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants