Skip to main content

AssertionRegExp Syntax to define boundary of lines/words

^

RegExp Assertion to negate Character Class or only match start of line

$

RegExp Assertion to match n expression at end of line

|

RegExp Assertion OR operator for alternative characters/expressions

\b

RegExp Assertion to match only at boundary of word (beginning or end of word)

\B

inverted RegExp Assertion to match only at not boundary of word (beginning or end of word)

n(?=abc)

Positive Lookahead to match n only if abc exists ahead

n(?!abc)

Negative Lookahead to match n only if abc not exist ahead

(?<=abc)n

Positive Lookbehind Assertion to match n only if abc exists before

(?<!abc)n

Negative Lookbehind to match n only if abc not exist before

References

  1. ^RegExp Assertion to negate Character Class or only match start of line

  2. |RegExp Assertion OR operator for alternative characters/expressions

  3. \B ↔ inverted RegExp Assertion to match only at not boundary of word (beginning or end of word)

  4. \bRegExp Assertion to match only at boundary of word (beginning or end of word)

  5. $RegExp Assertion to match n expression at end of line

  6. Flag ↔ optional modifier for RegExp to config how Assertion behave on patterns