You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When constructing an NFA from a regular expression that combines ^ and |, the resulting automaton can have unexpected languages (only partial or even empty).
Example
Consider the expression ^a|b. I interpret this as (^a)|(b), expecting both a and b to be included in the language. However, the following NFAs (without trimming or renamed states) produce different results:
Regex ^a|b: This results in an automaton with an empty language.
Omitting ^ in regexes could partially suppress this issue.
The text was updated successfully, but these errors were encountered:
koniksedy
changed the title
A combination of ^ with | in regex results in weird language
Combining ^ with | in regex leads to unexpected behavior
Oct 30, 2024
When constructing an NFA from a regular expression that combines
^
and|
, the resulting automaton can have unexpected languages (only partial or even empty).Example
Consider the expression
^a|b
. I interpret this as(^a)|(b)
, expecting botha
andb
to be included in the language. However, the following NFAs (without trimming or renamed states) produce different results:Regex
^a|b
: This results in an automaton with an empty language.Regex
(^a)|b
: This results in an automaton with the language{b}
, although I would expect it to includea
as well.Regex
a|b
: This produces an automaton with the expected language{a, b}
.Omitting
^
in regexes could partially suppress this issue.The text was updated successfully, but these errors were encountered: