Skip to content

Commit a068713

Browse files
author
Ron Petrusha
authored
Clarified and anchors (#6105)
1 parent c318d79 commit a068713

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/standard/base-types/anchors-in-regular-expressions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ ms.author: "ronpet"
2323

2424
|Anchor|Description|
2525
|------------|-----------------|
26-
|`^`|The match must occur at the beginning of the string or line. For more information, see [Start of String or Line](#Start).|
27-
|`$`|The match must occur at the end of the string or line, or before `\n` at the end of the string or line. For more information, see [End of String or Line](#End).|
26+
|`^`|By default, the match must occur at the beginning of the string; in multiline mode, it must occur at the beginning of the line. For more information, see [Start of String or Line](#Start).|
27+
|`$`|By default, the match must occur at the end of the string or before `\n` at the end of the string; in multiline mode, it must occur at the end of the line or before `\n` at the end of the line. For more information, see [End of String or Line](#End).|
2828
|`\A`|The match must occur at the beginning of the string only (no multiline support). For more information, see [Start of String Only](#StartOnly).|
2929
|`\Z`|The match must occur at the end of the string, or before `\n` at the end of the string. For more information, see [End of String or Before Ending Newline](#EndOrNOnly).|
3030
|`\z`|The match must occur at the end of the string only. For more information, see [End of String Only](#EndOnly).|
@@ -34,7 +34,7 @@ ms.author: "ronpet"
3434

3535
<a name="Start"></a>
3636
## Start of String or Line: ^
37-
The `^` anchor specifies that the following pattern must begin at the first character position of the string. If you use `^` with the <xref:System.Text.RegularExpressions.RegexOptions.Multiline?displayProperty=nameWithType> option (see [Regular Expression Options](../../../docs/standard/base-types/regular-expression-options.md)), the match must occur at the beginning of each line.
37+
By default, the `^` anchor specifies that the following pattern must begin at the first character position of the string. If you use `^` with the <xref:System.Text.RegularExpressions.RegexOptions.Multiline?displayProperty=nameWithType> option (see [Regular Expression Options](../../../docs/standard/base-types/regular-expression-options.md)), the match must occur at the beginning of each line.
3838

3939
The following example uses the `^` anchor in a regular expression that extracts information about the years during which some professional baseball teams existed. The example calls two overloads of the <xref:System.Text.RegularExpressions.Regex.Matches%2A?displayProperty=nameWithType> method:
4040

docs/standard/base-types/regular-expression-language-quick-reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ ms.author: "ronpet"
8787

8888
|Assertion|Description|Pattern|Matches|
8989
|---------------|-----------------|-------------|-------------|
90-
|`^`|The match must start at the beginning of the string or line.|`^\d{3}`|"901" in<br /><br /> "901-333-"|
91-
|`$`|The match must occur at the end of the string or before `\n` at the end of the line or string.|`-\d{3}$`|"-333" in<br /><br /> "-901-333"|
90+
|`^`|By default, the match must start at the beginning of the string; in multiline mode, it must start at the beginning of the line.|`^\d{3}`|"901" in<br /><br /> "901-333-"|
91+
|`$`|By default, the match must occur at the end of the string or before `\n` at the end of the string; in multiline mode, it must occur before the end of the line or before `\n` at the end of the line.|`-\d{3}$`|"-333" in<br /><br /> "-901-333"|
9292
|`\A`|The match must occur at the start of the string.|`\A\d{3}`|"901" in<br /><br /> "901-333-"|
9393
|`\Z`|The match must occur at the end of the string or before `\n` at the end of the string.|`-\d{3}\Z`|"-333" in<br /><br /> "-901-333"|
9494
|`\z`|The match must occur at the end of the string.|`-\d{3}\z`|"-333" in<br /><br /> "-901-333"|

0 commit comments

Comments
 (0)