Home > Theory Of Computation > Regular Expression Examples

Regular Expression Examples

Regular Expression Examples


Describe The Following Sets Of Regular Expressions

  1. {0,1,2} 
  2. {∧,ab}
  3. {abb,a,b}
  4. {∧,0,00,000….}
  5. {1,11,111,1111,……}

How To Form Regular Expressions From Above Sets??



This Is The Set Given Containing Symbols 0,1,2

That Means It Could Contain 0 Or 1 Or 2

These Are Symbols Contained In The Set.


In Regular Expression, It Can Be Written Like This

R=0+1+2 // + Is Or


2.{∧,ab}  // ∧ Is Empty Symbol

The Above Set Will Be Denoted Like This

R=∧ ab

// If You See The First Set {0,1,2}, In This Set The Empty Symbol Was Not Included And This Contains More Than One Symbol, We Used The ‘+’ Symbol To Denote.

But In This Set {∧, ab}, There Only One Symbol(ab) And An Empty Symbol Empty(∧) Symbol Along With It, You Don’t Have To Use The ‘+’ Or “or” Symbol You Can Just Write ∧ And ab

R=∧ ab // This Is The Regular Expression.


3) {abb,a,b,bba}

The Given Set Contains abb a b bba

So, This Means That It Can Be Anything Like abb Or a Or b Or bba

So Any Of These Symbols Can Be Present In The Set.


A Language That Which Contains These Any Of These Symbols Will Be Accepted.

Regular Expression For The Given Set Is 

R=abb+a+b+bba // + Means Or


4) {∧,0,00,000….}

If You Look The Given Set Carefully, You Find That These Are Any Strings That Can Be Formed By Using The ‘0’ Symbol

0 00 000 0000….Any More 0’s That Can Be Formed By Putting Together Any Number Of 0’s That You Want

So All The Strings That Can Be Formed Using  0 Along With The Symbol Empty Symbol, It Denotes The Closure Of 0


So {∧,0,00,000….} This Is The Closure Of 0

So How Do We Denote Regular Expression Closure

R=0* // * Denotes The Closure


5) {1,11,111,1111,……}

Here We Have 1 11 111 1111 …..

So This Also Means Any Strings That Can Be Formed By Using Symbol 1

So You Can Put Any Nuber Of 1’s Together And Whatever You Form Is The Set Here

So Is This The Closure Of 1?

It Looks Like The Closure Of 1 But This Is Not The Closure Of 1, Why?

We Can Call It Closure Only When All The Strings That Can Be Formed By The Symbol Along With The Empty Symbol(∧) Is Included But Here We See That The Empty Symbol Is Not Included So We Cannot Call This A Closure

So Regular Expression For Given Set Is

R=1×// 1× Denotes The Closure Of 1 Excluding The ∧ Empty Symbol, So This Is How We Denote When Empty Symbol Is Not Present



This Is How We Express Set’s Are Regular Expressions, I Hope This Was Useful To You Share This Post With Your Friends And Help Them In Understanding Regular Examples







7 thoughts on “Regular Expression Examples

  1. Hello. I have checked your smartcse.com and i see you’ve got
    some duplicate content so probably it is the reason that you don’t rank high in google.

    But you can fix this issue fast. There is a tool that rewrites articles like human, just search in google: miftolo’s

Leave a Reply

Secured By miniOrange