Regular expression in theory of computation solved examples Part – 2

9004

This is 2nd Part of Regular expression in theory of computation solved examples. You can also read Regular expression in theory of computation solved examples Part – 1. 

4. Construct a regular expression for the set of all strings over (A, . . . ., Z, a, . . . . , z) that contain the word “main”.

Solution:

We have the input alphabets ∑ = {A, . . . ., Z, a, . . . . , z}

Here, the resultant regular expression will denote the set of all string over the given ∑ which contains the word “main”.

In the first step, let us assume that

            <letter> = {A, . . . , Z, a, . . . . . z}

Thus, the regular expression for the set of all strings over the given ∑ can be written as-

<letter>*

Thus, the required resultant regular expression which contains the word “main” can be written as-

            <letter>* main <letter>*

Previous QuizRegular expression in theory of computation solved examples
Next QuizRegular expression examples in theory of automata Part – 3

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.