You've now seen the fundamental operators used in building regular expressions. Now let's look at the more complex types of regular expressions that can be built up using those operators.
Operators can be used multiple times in the same expression.
Example
Σ = {a, b, c, d, e}
R = a ∪ b ∪ c ∪ d ∪ e
This regular expression recognizes the strings:
Example
Σ = {a, b, c, d, e}
R = abcde
This regular expression recognizes the string abcde.
Note
While this is also true for the Kleene closure operator, I'll omit an example because, for any regular expression R, R** = R*.
More complex regular expressions can be built up using multiple operators.
Example
Σ = {a, b, c}
R = ab ∪ c*
This regular expression recognizes the strings:
Example
Σ = {a, b, c}
R = a(b ∪ c*)
This regular expresion recognizes the strings:
Since there is no maximum depth to expressions in parentheses, any order of operations can be applied deep down into regular expressions.
Example
Σ = {a, b, c, d, e, f}
R = a(b ∪ c(d(e ∪ f)*)*)
This regular expression recognizes the strings:
Note
Not every string has been enumerated here. The above examples simply illustrate some of the strings that belong to the specified language.
GitHub Repository: https://github.com/bprollinson/ripal
Copyright © 2017 Brendan Rollinson-Lorimer