go to previous page   go to home page   go to next page

Answer:

[ab]+


Example 4

Regular Expression
(Delimit with quotes)
String
(Delimit with quotes)

What regular expression specifies the set of strings consisting only of a's and b's which start with at least one 'a' and end with at least one 'b':

Accepted:

ab, aab, abb, aaab, abbb, abab, aabb,
aaaab, aaabb, aabbb, abbbb, abaab, ababb,  
aabbababbabababb

But Not:

a, b, aa, bb, ba, aaa, bbb, bab, aba, bba,
aaaa, bbbb, baaa, bbaa, bbba, abaa, ...

QUESTION 27:

What is the RE?