Metacharacters
The following regular expression characters cause a match to succeed or fail depending on the position of the match within the text.
Example: 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 text or the beginning of the line. |
$ | The match must occur at the end of the text, before \n at the end of the text, or at the end of the line. |
\A | The match must occur at the beginning of the text (ignores the Multiline option).* |
\Z | The match must occur at the end of the text or before \n at the end of the text (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.* |