Regular expressions are used to generate patterns of strings. A regular expression describes patterns using operators like union, concatenation, and Kleene closure. Some examples of regular expressions include:
1) Describing Canadian postal codes as /^[A-Z][0-9][A-Z] [0-9][A-Z][0-9]$/
2) Matching strings containing the word "main" as <letter>* main <letter>*
3) Matching strings of even length as (<letter><letter>)*