Consider the following regular expressions:
- 7+
- (7)+
Does anyone that is very familiar with regular expression theory in Mathematics agree that the two regular expressions are semantically the same?
Consider the following regular expressions:
Does anyone that is very familiar with regular expression theory in Mathematics agree that the two regular expressions are semantically the same?
Do they describe the same language? Yes. Do they mean the same thing to someone trying to interpret the language? No. The second one tells me that I should be more interested in the 7s.
Yes, those two regular expressions are the same because they both recognize the same language. The fact that they are not written identically is just a notational issue.
Programmatically (as in evaluated by the regular expression engine of a language) it only differs in the capturing groups resulting.
Other than that, they are the same. It is as writing ((7) + (1))
as opposed as 7 + 1
. They evaluate to are the same. (Yeah, mathematically speaking, regular languages doesn't evaluate to anything)
The second reduces to first. Do you agree that
ab+
and
a(b)+
and
(ab)+
are semantically different?
The only difference is the parens assign the enclosed pattern to a group so you can reference that little piece after it's been evaluated.