Metacharacters
The following regular expression characters cause a match to succeed or fail depending on the current position in the string.
Example: ^ specifies that the current position is at the beginning of a line or string. The regular expression ^FTP returns only those occurrences of the character string "FTP" that occur at the beginning of a line.
| Regular Expression | Description |
|---|---|
| ^ | The match must occur at the beginning of the string or line. |
| $ | The match must occur at the end of the string, before \n at the end of the string, or at the end of the line. |
| \A | The match must occur at the beginning of the string (ignores the Multiline option). |
| \Z | The match must occur at the end of the string or before \n at the end of the string (ignores the Multiline option). |
| \G | The match must occur at the point where the previous match ended. When used with Match.NextMatch(), this ensures that matches are all contiguous. |
| \b | The match must occur at a boundary between a word character (\w) and a nonword character (\W) |
| \B | The match not must occur at the boundary between a word and a nonword character. |