Atomic Zero-width Assertions

RegEx Builder

Atomic Zero-width Assertions
Previous Top Next


·     Beginning of line (^)
Matches the beginning of a line.  Use this when you want to make sure that you expression only matches strings at the beginning of a line.  This must be the first character in the expression.

·     End of line ($)
Matches the end of a line.  Use this when you want to make sure that you expression only matches strings at the end of a line.  This must be the last character in the expression.  You can use both the ^ and $ to ensure that you expression matches only complete lines.

·     Beginning of string, ignore multiline (\A)
Specifies that the match must occur at the beginning of the string (ignores the Multiline option).

·     End of string, but before \n, ignoring multiline (\Z)
Specifies that the match must occur at the end of the string or before \n at the end of the string (ignores the Multiline option).

·     End of string, ignoring multiline (\z)
Specifies that the match must occur at the end of the string (ignores the Multiline option).

·     At end of last match (\G)
Specifies that the match must occur at the point where the previous match ended. When used with Match.NextMatch(), this ensures that matches are all contiguous.

·     Word boundary, between \w and \W (\b)
Matches expression on word boundaries.  For example: (ve)\b will match the "ve" in "live", but not the "ve" in "liver".

·     Not on word boundary (\B)
Matches expressions on non-word boundaries.  For example, (ve)\B will match the "ve" in "liver", but not the "ve" in "live".


For detailed information on these constructs see the online reference at MSDN: