Regular Expression Operators
For Complete YouTube Video: Click Here
In this class, We discuss Regular Expression Operators.
The reader should have prior knowledge of regular expression. Click Here.
Take a few examples and understand regular expression operators.
Union Operator:
Example: Take two languages L1 and L2 over an alphabet Σ = {0,1}.
L1 is a set of strings containing only zero. L1 = {0}.
L2 is a set of strings containing only one. L2 = {1}.
Union operator on the L1 and L2 is the string containing either from L1 or L2 or both.
L1 ∪ L2 or L1 + L2 contain the following strings. L1 + l2 = {0,1}.
Union operator uses the union symbol or plus symbol.
Most of the time, we use the symbol plus.
We take one more example for better understanding.
Example: L1 = {001, 100} and L2 = {ε, 10, 001}
L1 + L2 = {ε, 10, 001, 100}.
Concatenation Operator:
Example: Take two languages L1 and L2.
L1 = {001, 10, 111} and L2 = {ε, 001}
In the Concatenation operation, we select a string from L1 and concatenate it with any other string from L2.
The concatenation operator is given a dot symbol. Or simply without a dot symbol.
L1.L2 or L1L2 = {001, 10, 111, 001001, 10001, 111001}
Closure or Star or Kleen Closure Operator
Take a language L1.
The language L1 = {0, 11}.
L1* is a set of strings that is formed by taking any number of strings from L1. (Probably with repetition) and concatenate all of them.
From L1, we can pick zero, and the second time we can select 11, and the third time we can choose 0 and concatenate.
Epsilon is also possible in star operators.
Do not pick any string. This option is also possible in the star operator.
L1* = {ε,0, 00, 011, 01111, 110, . . . .}
We can select any of the possibilities any number of times.