Backport missed remarks on Regex constructors#131248
Conversation
|
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>
|
Replaces #131168. |
There was a problem hiding this comment.
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 useregion(matching the#region RegexCtorStringOptionsblock in the examples file) rather thanid, 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 useregion(matching the#region RegexCtorStringOptionsMatchTimeoutblock) rather thanid, 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>
| /// <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" /> |
There was a problem hiding this comment.
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/.
There was a problem hiding this comment.
Also separate source files in <code> elements are silently ignored for Learn docs generation: https://dev.azure.com/ceapex/Engineering/_workitems/edit/1163255
|
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions |
These remarks and examples were missed in #127038.
Converts the CDATA/Markdown
<remarks>blocks added to the three publicRegexconstructors into standard XML doc comments that render correctly in IntelliSense.Regex.cs— For each ofRegex(string),Regex(string, RegexOptions), andRegex(string, RegexOptions, TimeSpan):<remarks><format type="text/markdown"><![CDATA[...]]></format></remarks>with standard<remarks>using<para>,<list>,<see cref>,<see href>,<paramref>, and<c><remarks>into<example><code lang="cs" source="..." region="..." /></example>blocks placed after<remarks>and before<exception>, referencing regions in the examples fileRegex.Examples.cs— AddedRegexConstructorExamplesclass with three[Fact]methods covering the constructor overloads, each wrapped in a named#regionblock (RegexCtorString,RegexCtorStringOptions,RegexCtorStringOptionsMatchTimeout).Fixes dotnet/dotnet-api-docs#12869.