Regular Expression - Logical Matcher

> Procedural Languages > Multilingual Regular Expression Syntax (Pattern)

1 - About

Logical matcher represents:

  • the AND operation (which is a follow operation in a regular expression)
  • and the OR.

The character '^' in a class represents a NOT operator


3 - Syntax

Construct Matches
XY X followed by Y
X|Y Either X or Y

The | is the Boolean “or”. It start of alternative branch to specify alternative matches

4 - Example

gray|grey matches:

  • gray
  • and grey