Top  Previous  Next

Scripts > Token definitions > Regular expressions > Alternatives


A regular expression can contain alternatives. That means, the whole expression matches the text, if one of the alternatives matches. Alternatives are separated by the pipe character "|".




"a(b|c)" matches "ab" or "ac".


"abc|def" matches "abc" or "def", but not "abdef".


At the last example you can see, that each alternative contains the largest possible sub-expression (in contrast to repetitions see below). "abc|def" is not "ab" followed by "c" or "def", but "abc" or "def".


This page belongs to the TextTransformer Documentation

Home  Content  German