- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- 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 by the user.

Regular expression is the language which is used to describe the language and is accepted by finite automata. Regular expressions are the most effective way to represent any language. Let Σ be an alphabet which denotes the input set.

The regular expression over Σ can be defined as follows −

- Φ is a regular expression which denotes the empty set.
- ε is a regular expression and denotes the set { ε} and it is called a null string.
- For each ‘a’ in Σ ‘a’ is a regular expression and denotes the set {a}.
- If r and s regular expressions denoting the language.
- L1 and l2 respectively then,
- r+s is equivalent to L1 U L2 union
- rs is equivalent to L1L2 concatenation
- r* is equivalent to L1* closure

The r* is known as Kleen closure or closure which indicates occurrence of r for an infinite number of times.

## Problem 1

Write the regular expression for the language accepting all combinations of a's, over the set l: = {a}

## Solution

All combinations of a's means that a may be zero, single, double and so on. If a is appearing zero times, that means a null string. That is, we expect the set of {E, a, aa, aaa, ....}. So we give a regular expression for this as follows −

R = a*

That is Kleen closure of a.

## Problem 2

Write the regular expression for the language accepting all combinations of a's except the null string, over the set l: = {a}

## Solution

The regular expression has to be built for the language L = {a, aa,aaa, ....}

This set indicates that there is no null string. So, we can denote regular expression as follows −

R = a+

## Problem 3

Write the regular expression for the language L over l: = {O, l} such that all the strings do not contain the substring 01.

## Solution

The Language is as follows −

L = {E, 0, 1,00, 11,10,100,.....}

The regular expression for the above language is as follows −

R = (1* O*)

## Problem 4

Write the regular expression for the language containing the string in which every 0 is immediately followed by 11.

## Solution

The regular expectation will be: R = (011+ 1)*

- Related Articles
- Construct the Regular expression for the given languages.
- Explain the Java regular expression construct "re?".
- Find out the Regular expression for the given finite automata
- Construct a Finite Automata for the regular expression ((a+b)(a+b))*.
- Regular Expression "[^...]" construct in Java
- 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
- Find the regular expression for the given Finite automata with state elimination method
- C Program to construct DFA for Regular Expression (a+aa*b)*
- C++ Program to Construct an Expression Tree for a given Prefix Expression
- Construct a pair of languages by using CFG
- What are the identity rules for regular expression?
- What are the closure properties of Regular languages?