Operator precedence and parentheses

Quantifiers have high precedence and Alternation has low precedence

  • ab+ is equivalent to a(b+)
    • “a” followed by one or more “b”s
  • ^a|b$ is equivalent to (^a)|(b$)
    • a string starting with “a” or a string ending with “b”

Use parentheses to override the usual order and or improve legibility.