Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the .NET regular expressions documentation to introduce and explain the new RegexOptions.AnyNewLine option (starting in .NET 11), including how it affects anchors and the . wildcard across common newline sequences.
Changes:
- Adds
RegexOptions.AnyNewLineto the options reference table and the “options that can’t be set inline” list. - Introduces a new “AnyNewLine mode” section with behavioral details and examples.
- Cross-links related docs (anchors and character classes) to describe how
$,\Z, and.behave underAnyNewLine.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docs/standard/base-types/regular-expression-options.md | Documents RegexOptions.AnyNewLine, adds a new dedicated section, and updates option lists. |
| docs/standard/base-types/character-classes-in-regular-expressions.md | Notes how . changes under AnyNewLine and links back to the new mode section. |
| docs/standard/base-types/anchors-in-regular-expressions.md | Adds guidance for $ and \Z when using AnyNewLine instead of \r? workarounds. |
docs/standard/base-types/character-classes-in-regular-expressions.md
Outdated
Show resolved
Hide resolved
Add AnyNewLine mode section to Regular Expression Options article. Add tips/notes about AnyNewLine in: - Multiline mode section (as alternative to \r?\$ workaround) - Anchors doc (\$ and \Z sections) - Character classes doc (Any character: . section) - Quick reference (options table) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4997e15 to
4e793e8
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds documentation for the new RegexOptions.AnyNewLine behavior across the core regex conceptual articles, explaining how it changes newline handling for anchors and the . wildcard.
Changes:
- Documents
RegexOptions.AnyNewLinein the options reference table and option-setting guidance. - Adds a dedicated “AnyNewLine mode” section with examples and a behavior summary table.
- Updates anchor and character class docs to reference
AnyNewLineand link to the new section.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/standard/base-types/regular-expression-options.md | Adds AnyNewLine to the options list, introduces a new section describing its semantics, and adds examples/table. |
| docs/standard/base-types/character-classes-in-regular-expressions.md | Notes how AnyNewLine changes . behavior and precedence with Singleline. |
| docs/standard/base-types/anchors-in-regular-expressions.md | Notes how AnyNewLine changes $ and \Z behavior vs \r? workarounds. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
red because links need merge of dotnet/dotnet-api-docs#12405 |
|
@copilot fix feedback |
Apply gewarren's suggestion to align table columns for readability. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clarifies that the . behavior described applies without Singleline, consistent with how other rows qualify their mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the new
RegexOptions.AnyNewLineoption in conceptual docs, shipping in .NET 11 Preview 3.Changes
regular-expression-options.md[!TIP]in the Multiline mode section pointing toAnyNewLineas an alternative to the\r?$workaroundanchors-in-regular-expressions.mdAnyNewLineas an alternative to\r?$AnyNewLineas an alternative to\r?\Zcharacter-classes-in-regular-expressions.mdAnyNewLineeffect on.Context
AnyNewLinemakes^,$,\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 regex pitfalls in .NET -- that$doesn't match before\r\nand.matches\r.Related:
Internal previews