You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/standard/base-types/anchors-in-regular-expressions.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,8 @@ ms.author: "ronpet"
23
23
24
24
|Anchor|Description|
25
25
|------------|-----------------|
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).|
28
28
|`\A`|The match must occur at the beginning of the string only (no multiline support). For more information, see [Start of String Only](#StartOnly).|
29
29
|`\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).|
30
30
|`\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"
34
34
35
35
<aname="Start"></a>
36
36
## 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.
38
38
39
39
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:
|`^`|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"|
92
92
|`\A`|The match must occur at the start of the string.|`\A\d{3}`|"901" in<br /><br /> "901-333-"|
93
93
|`\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"|
94
94
|`\z`|The match must occur at the end of the string.|`-\d{3}\z`|"-333" in<br /><br /> "-901-333"|
0 commit comments