## 9.6.Union

The first, and most familiar, is the union operator, which we shall denote |. The rule for the union is that if R and S are two regular expressions, then R | S
denotes the union of the languages that R and S denotes.
That is L(R|S) = L(R) L(S)

Examples:

• We know, that a is a regular expression denoting { a }, and b is a regular expression denoting { b }. Thus a | b
is a regular expression denoting by { a, b }. That is the set that contains two strings a and b, and each string has the length 1.
• We know, that a is a regular expression denoting { a }, and b is a regular expression denoting { b }, and c is a regular expression denoting { c }, Thus ( a | b ) | c
is a regular expression denoting by { a, b, c }. That is the set that contains three strings a, b and c, and each string has the length 1.

Concatenation

The second operator for the algebra of regular expressions is called concatenation. It is represented by no operator symbol at all, just like the multiplication sometimes written without an operator. Like union, concatenation is an infix operator. The rule for the concatenation is that if R and S are two regular expressions, then RS

denotes the concatenation of the languages R and S. L(RS), the language is denoted by RS is formed from the language L(R) and L(S) as follows. For each string r in L(R) and each string s in L(S) the string rs, the concatenation of r and s, is in L(RS).

Examples:

• Let R be the regular expression c, and let L(R) is the set { c }. Let S be the regular expression a, and so let L(S) is the set { a }.

Then RS is the expression ca. To form L(RS), we need to take every string in L(R) and concatenate it with every string in L(S).

Thus L(RS) = { ca }.

• Let R be the regular expression c, and so L(R) is the set { c }. Let S be the regular expression a, and so L(S) is the set { a }. Let T be the regular expression t, and so L(T) is the set { t }.

Then (RS)T is the expression (ca)t = cat. To from L(RST), we need to take every string in L(R) and concatenate it with every string in L(S) and concatenate the result with every string in L(T).

Thus L(RST) = { cat }.

• Now let us look at the concatenation of two regular expressions whose languages are not singleton sets.

Let R be the regular expression a | (ab).
The language L(R) is the union of L(a) and L(ab), that is { a, ab }. Let S be the regular expression c | (bc).
Similarly L(S) = { c, bc }. RS = ( a | (ab))(c | (bc)) = ( ac, abc, abc, abbc )

Closure

The third operator is called closure. It is an unary postfix operator. Closure is denoted as a star, so R* is the closure of the regular expression R. The effect of the closure operator is to say, ``zero or more occurrences of strings R''. So L(R*) consists of

1.
the empty string .
2.
all the strings in L(R).
3.
all the strings in L(RR)
4.
all the strings in L(RRR) ...

We can informally write: R* = | R | RR | RRR | RRR | ...