In the theory of computation, why are regular expressions (ab)* and a*b* not equal?

Soumya Pawar

What is the language expressed by these expressions and why aren't they equal?

xenteros

L1 = (ab)* stands for ab repeated 0 or more times.
L2 = a*b* stands for a repeated 0 or more times followed by b repeated 0 or more times.

Those languages aren't equal because word abab is in language L1 but it's not in language L2.
Those languages aren't equal because word a is in language L2 but it's not in language L1.

There is a very useful service web service used for comparing regular expressions. Once you type in the regular expression, it describes it and let's you test it.

Examples of words in those languages:

L1:

  • ""
  • "ab"
  • "abab"
  • "ababab"

L2:

  • ""
  • "a"
  • "aa"
  • "bbbb"
  • "ab"
  • "aaaabbbbbbb"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Why are Java regular expressions compiled?

From Dev

Computation expressions for a Haskell programmer

From Dev

Regular Expressions Java, why is this regex so slow?

From Dev

Wrangling TryWith in Computation expressions

From Dev

Why can't regular expressions match for @ sign?

From Dev

Regular Expression for (1ab09cs001)

From Dev

Regular Expression for evaluating string which do not contains both substring 'ab' and 'cd' in order

From Dev

Can a Struct Named "AB" Contain an Array of AB?

From Dev

Always off Bit AB

From Dev

regular expressions : (.*), (.*?) and .*

From Dev

the mechanics of let! in computation expressions

From Dev

Why are regular expressions wrapped in forward slashes

From Dev

How to verify AB responses?

From Dev

Why does the 'is' operator behave unexpectedly with arithmetically equal expressions

From Dev

Mutual recursion with computation expressions

From Dev

why is O(n^2) vs O(ab) different?

From Dev

Regular Expressions

From Dev

Why does the 'is' operator behave unexpectedly with arithmetically equal expressions

From Dev

XPath: How to search with AB--AB for AB??AB or AB?-AB

From Dev

Wrangling TryWith in Computation expressions

From Dev

SQL 'ab,cd' compared with 'cd,ab' is true

From Dev

Regular Expressions?

From Dev

Why those two expressions are not equal?

From Dev

\\s, for regular expressions, why we need 2 "\"

From Dev

Why doesn't `echo abc^H` just print `ab`?

From Dev

Regular Expressions # of /

From Dev

Regular expressions - They are the same regular expressions?

From Dev

Computation theory - DFA

From Dev

How to match two consecutive alphabets like AA, BB not AB, BD with Regular expression in python?

Related Related

HotTag

Archive