HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Regular expression for strings not starting with 10

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
expressionstartingwithregularstringsfornot

Problem

How can I construct a regular expression for the language over $\{0,1\}$ which is the complement of the language represented by the regular expression $10(0+1)^*$?

Solution

If a word doesn't start with $10$, then either it starts with some other combination of two letters, or it is shorter than two letters. All in all, we get the following regular expression for your language:
$$
\epsilon + 0 + 1 + (00+01+11)(0+1)^*.
$$

Context

StackExchange Computer Science Q#118174, answer score: 2

Revisions (0)

No revisions yet.