4-Reg Exp
4-Reg Exp
• The value of the arithmetic expression is the number 32. The value of a regular expression is a
language.
• In this case, the value is the language consisting of all strings starting with a 0 or a 1 followed by
any number of 0s.
• The symbols 0 and 1 are shorthand for the sets {0} and {1}. So (0 ∪ 1) means ({0} ∪ {1}). The
value of this part is the language {0,1}.
• The part 0* means {0}* and its value is the language consisting of all strings containing any
number of 0s.
Regular Expressions
• Applications of regular expressions include:
• Powerful method for describing patterns in text.
• Utilities such as awk and grep in UNIX, modern programming languages such
as Perl, and text editors all provide mechanisms for the description of
patterns by using regular expressions.
Examples
all possible strings of 0s and 1s. If Σ = {0,1}, we can write Σ as shorthand for the
regular expression (0 ∪ 1).