Question:

What is the regular expression for all strings starting with ab then any number of a or b and ending with bba?

Show Hint

Use (a+b)* to denote any number of a’s or b’s in regex. Ensure prefixes and suffixes match.
Updated On: June 02, 2025
  • aba*b*bba
  • ab(ab)*bba
  • ab(a+b)*bba
  • ab(a+b)bba
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Start with "ab", followed by any number of "a" or "b": \((a+b)^*\), and end with "bba" gives: \[ ab(a+b)^*bba \]
Was this answer helpful?
0
0

TS PGECET Notification