- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Construct the Regular expression for the given languages.

## Problem 1

Write the regular expression for the language accepting all the strings containing any number of a's and b's.

## Solution

The regular expression will be −

r.e. = (a + b)*

This will give the set as L = {E, a, aa, b,bb,ab,ba, aba, bab,.....},any combination of a and b.

The (a + b)* shows any combination with a and b even a null string.

## Problem 2

Write the regular expression for the language starting with a but not having consecutive b's.

## Solution

The regular expression has to be built for the language: L = {a, aba, aab, aba, aaa, abab, .....}

The regular expression for the above language is −

R = {a + ab}*

## Problem 3

Write the regular expression for the language accepting all the string in which any number of a's is followed by any number of b's is followed by any number of e's.

## Solution

As we know, any number of a's means a* any number of b's means b*, any number of e's means c*. Since as given in the problem statement, b's appear after a's and e's appear after b's. So the regular expression could be −

R = a* b* c*

## Problem 4

Describe the language denoted by following regular expressions r.e. = (b* (aaa)* b*)*

## Solution

The language can be predicted from the regular expression by finding the meaning of it. We will first split the regular expression as −

r.e .= (any combination of b's) (aaa)* (any combination of b's)

L = {The language consists of the string in which a's appear triples, there is no restriction on the number of b's}

- Related Articles
- Construct the Regular expression for the given languages by the user.
- Explain the Java regular expression construct "re?".
- Regular Expression "[^...]" construct in Java
- Construct a Finite Automata for the regular expression ((a+b)(a+b))*.
- Find out the Regular expression for the given finite automata
- Construct NFA with Epsilon moves for regular expression a+ba*.
- Regular Expression "d" construct in Java
- Regular Expression "A" construct in Java
- Regular Expression "z" construct in Java
- C Program to construct DFA for Regular Expression (a+aa*b)*
- C++ Program to Construct an Expression Tree for a given Prefix Expression
- Find the regular expression for the given Finite automata with state elimination method
- What are the identity rules for regular expression?
- What are the closure properties of Regular languages?
- Python Program to Construct an Expression Tree of a given Expression