About
An assertion is an assertion that specifies a condition that has to be met at a particular point in a match, without consuming any characters from the subject string.
Articles Related
Type
Simple
simple assertion designed by the backslash character.
assertions | Description |
---|---|
\b | word boundary |
\B | not a word boundary |
\A | start of subject (independent of multiline mode) |
\Z | end of subject or newline at end (independent of multiline mode) |
\z | end of subject (independent of multiline mode) |
\G | first matching position in subject |
These assertions may not appear in character classes (but note that “\b” has a different meaning, namely the backspace character, inside a character class).
Look-around
Regexp - Look-around group (Assertion) - ( Lookahead | Lookbehind )