# Regular expressions for all strings with at least two a

## (a + b)* a (a + b)* a (a + b)*

### Valid strings: (must be accepted by our Regular Expression)

Strings of length 1: No valid strings

Strings of length 2: aa, No other valid strings

Strings of length 3: aaa, aab, baa, No other valid strings

Strings of length 4: aaaa, baab, aaab, baaa,……. and many other similar strings.

Strings of length 5: aaaab, aaaba, aaabb, abba, aabaa, bbbaa,………and many other similar strings.

Note: Many other strings of lengths 6, 7, 8. 9, 10 11, ….etc that have at least two a. You can try it by yourself.

### Invalid strings: (must be Rejected by our Regular Expression)

Strings of length 1: b, a No other invalid strings

Strings of length 2: bb, ab, ba,  No other invalid strings

Strings of length 3: abb, bab, bbb, bba,  bbb, No other invalid strings

Note: All other strings defined over {a, b) that not have at least two a’s are invalid strings. You can try it by yourself.

## Write a Regular expressions defined over {a, b} for all strings with at least two b’s.

(a + b)* b (a + b)* b (a + b)*

## Write a Regular expressions defined over {0, 1} for all strings with at least two 0’s.

(0 + 1)* 0 (0 + 1)* 0 (0 + 1)*

## Write a Regular expressions defined over {0, 1} for all strings with at least two 1’s.

(0 + 1)* 1 (0 + 1)* 1 (0 + 1)*