In

formal language theory
In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science), alphabet and are well-formedness, well-formed ...

and pattern matching
In computer science
Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application.
Computer science is the study of Algor ...

, alternation is the union of two sets of strings or patterns. As a pattern, the alternation of ''a'' and ''b'' matches either ''a'' or ''b''.
In formal language theory, alternation is commutative
In mathematics
Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...

and associative
In mathematics
Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...

. This is not in general true in pattern-matching languages.
In the SNOBOL
SNOBOL ("StriNg Oriented and symBOlic Language") is a series of programming language
A programming language is a formal language
In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer sc ...

language, regular expression
A regular expression (shortened as regex or regexp; also referred to as rational expression) is a sequence of Character (computing), characters that specifies a ''search pattern matching, pattern''. Usually such patterns are used by string-se ...

syntax, and some other languages, alternation is a binary
Binary may refer to:
Science and technology
Mathematics
* Binary number
In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: ty ...

infix operator
Infix notation is the notation commonly used in arithmetical and logical formulae and statements. It is characterized by the placement of Operator (mathematics), operators between operandsâ€”"infixed operators"â€”such as the plus sign in 2 + 2.
U ...

on patterns, notated ", ".
References

* John E. Hopcroft and Jeffrey D. Ullman, ''Introduction to Automata Theory, Languages and Computation'', Addison-Wesley Publishing, Reading Massachusetts, 1979. . Combinatorics on words Operators (programming) String (computer science) {{combin-stub