Insert a Regex Token to Match Different Alternatives

The Insert Token button on the Create panel makes it easy to insert a regular expression token to branch between other tokens in your regular expression. Branching is done with the “alternation” operator. See the Insert Token help topic for more details on how to build up a regular expression via this menu.

Alternation causes the overall regular expression or the group (if the alternation is inserted inside a group) to match if either the part to the left of the vertical bar, or the part to the right of the vertical bar can be matched. You can insert multiple vertical bars to create more than two alternatives. Joe|Jack|Mary matches Joe, Jack or Mary.

If you want to alternate only part of a regular expression, you’ll need to place a group around the alternation. To match the names of the Dalton brothers, use (?:Joe|Jack|William|Avarell) Dalton.

Insert alternation