1.3 Regular Expressions What's an Arithmetic Expression? What are the operators and operands? 2 * (4 - 8) What type of object results from an Arithmetic Expression? What's a Regular Expression? What are the operators and operands? a*(a|b) What type of object results from a Regular Expression? What's the Formal Definition of a Regular Expression? R is a Regular Expression if R is: 1. a (for some symbol a in the alphabet) 2. epsilon 3. empty-set 4. (R1 | R2) (for some Regular Expressions R1 and R2) 5. (R1 R2) (for some Regular Expressions R1 and R2) 6. (R1*) (for some Regular Expression R1) What's the Language defined by a Regular Expression? L(a) {a} L(epsilon) {epsilon} L(empty-set) {} L(R1 | R2) L(R1) union L(R2) L(R1 R2) L(R1) concat L(R2) L(R1*) L(R1)* What's the order of operations in the expression? 1 + 2 + 3 * 4 What's the order of operations in the expression? a | b c* What's the Precedence of the Regular operators? Describe the language defined by the Regular Expression. ab*a a*b* a(a|b)* a(a|b)*b (a|b)*a(a|b)* (a|b)*(aa|bb)(a|b)* (a|b)*a(a|b)*a(a|b)* (a|b)*ab*ab* a* empty-set (empty-set)* a|empty-set a epsilon Write a Regular Expression for the language. (w is a string of 0's and 1's) All strings except the empty string (1.18n) { w | w has length >= 3 and its 3rd symbol is 0 } (1.18d) { w | w contains an even number of 0s, or contains exactly two 1s } (1.18l) Classwork (You may work with a partner.) Write a Regular Expression for the language. (w is a string of 0's and 1's) { w | w starts with 0 and has odd length, or starts with 1 and has even length } (1.18e) What are common applications of Regular Expressions? grep perl/python/php/ruby text editors