left up right
Regular Expressions
Branches
  • Regular expression consists of branches separated by |
  • Each branch can consist of a set of pieces
Pieces
  • A piece is an atom optionally followed by a quantifier
  • Quantifiers are ?, *, +, {quantity},
Atom
A normal character matches itself and possibly its other case if a flag is set.
A character class such as escaped characters (\n etc), a character group such as [a-z], [^abc] (not abc) or a regexp
[0-9] [a-z]+

One branch consisting of two pieces matching a string consisting of a digit followed by one or more lower-case letters. + is the quantifier