Skip to content

Backport missed remarks on Regex constructors#131248

Draft
gewarren with Copilot wants to merge 3 commits into
mainfrom
copilot/update-xml-docs-regex-constructors
Draft

Backport missed remarks on Regex constructors#131248
gewarren with Copilot wants to merge 3 commits into
mainfrom
copilot/update-xml-docs-regex-constructors

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

These remarks and examples were missed in #127038.

Converts the CDATA/Markdown <remarks> blocks added to the three public Regex constructors into standard XML doc comments that render correctly in IntelliSense.

Regex.cs — For each of Regex(string), Regex(string, RegexOptions), and Regex(string, RegexOptions, TimeSpan):

  • Replaced <remarks><format type="text/markdown"><![CDATA[...]]></format></remarks> with standard <remarks> using <para>, <list>, <see cref>, <see href>, <paramref>, and <c>
  • Moved code examples out of <remarks> into <example><code lang="cs" source="..." region="..." /></example> blocks placed after <remarks> and before <exception>, referencing regions in the examples file

Regex.Examples.cs — Added RegexConstructorExamples class with three [Fact] methods covering the constructor overloads, each wrapped in a named #region block (RegexCtorString, RegexCtorStringOptions, RegexCtorStringOptionsMatchTimeout).

Fixes dotnet/dotnet-api-docs#12869.

Copilot AI review requested due to automatic review settings July 23, 2026 02:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

…ex constructors

- Replace <remarks><format type="text/markdown"><![CDATA[...]]></format></remarks>
  blocks on the three public Regex constructors with standard XML doc comments
  using <para>, <list>, <see cref>, <see href>, <paramref>, and <c> elements.
- Add <example><code lang="cs" source="..." region="..." /></example> blocks
  after <remarks>, referencing the examples file by region name.
- Add constructor example code to Regex.Examples.cs with #region blocks
  matching region names: RegexCtorString, RegexCtorStringOptions,
  and RegexCtorStringOptionsMatchTimeout.

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 02:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI changed the title [WIP] Update XML documentation for Regex public constructors Replace CDATA/Markdown XML doc remarks on Regex constructors with standard XML docs Jul 23, 2026
Copilot AI requested a review from gewarren July 23, 2026 03:00
Copilot AI review requested due to automatic review settings July 23, 2026 03:13
@gewarren

Copy link
Copy Markdown
Contributor

Replaces #131168.

@gewarren gewarren changed the title Replace CDATA/Markdown XML doc remarks on Regex constructors with standard XML docs Backport missed remarks on Regex constructors Jul 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs:123

  • Same as above: <code> should use region (matching the #region RegexCtorStringOptions block in the examples file) rather than id, so the snippet can be extracted/rendered correctly.
        /// <example>
        /// The following example uses this constructor to create a case-insensitive regular expression that matches words beginning with the letters "a" or "t".
        /// <code lang="cs" source="../../../../tests/FunctionalTests/Regex.Examples.cs" id="RegexCtorStringOptions" />
        /// </example>

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs:174

  • Same as above: <code> should use region (matching the #region RegexCtorStringOptionsMatchTimeout block) rather than id, otherwise the snippet selector likely won't work.
        /// <example>
        /// The following example creates a <see cref="Regex"/> object with a very short initial time-out and retries with a larger one if a timeout occurs.
        /// <code lang="cs" source="../../../../tests/FunctionalTests/Regex.Examples.cs" id="RegexCtorStringOptionsMatchTimeout" />
        /// </example>

Comment on lines +96 to +99
/// <example>
/// The following example uses this constructor to create a regular expression that matches words beginning with the letters "a" or "t".
/// <code lang="cs" source="../../../../tests/FunctionalTests/Regex.Examples.cs" id="RegexCtorString" />
/// </example>
/// </remarks>
/// <example>
/// The following example uses this constructor to create a regular expression that matches words beginning with the letters "a" or "t".
/// <code lang="cs" source="../../../../tests/FunctionalTests/Regex.Examples.cs" id="RegexCtorString" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure if we can use IDs/regions of code using <code> elements. See https://www.mono-project.com/docs/tools+libraries/tools/monodoc/editing/.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also separate source files in <code> elements are silently ignored for Learn docs generation: https://dev.azure.com/ceapex/Engineering/_workitems/edit/1163255

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

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.

Backport remarks/examples for System.Text.RegularExpressions

3 participants