In this section, you will learn to use logical operators to combine regex strings. This can be used to tailor search terms to be more specific about what variance is permitted.
Logical operators can be used to extend the usability of the match types already specified. Take, for example, the situation with security classifiers from the Using regexes to find characters in a set section of this chapter. In addition to U, C, and S, there is the designation TS for top secret. If specifying this using the set construct (square brackets []), this could be fixed by matching [UCST]{1,2}, but this would also match the invalid TU, TC, and TT combinations.
Instead, the logical OR character (|), (also known as pipe) can be used to separate out a group of options. For the security classifiers, something like (U|C|S|TS) would work.
The logical OR can also be used...