interegular icon indicating copy to clipboard operation
interegular copied to clipboard

[Bug] found a bug with handling choices

Open RevanthRameshkumar opened this issue 1 year ago • 8 comments

fsm = interegular.parse_pattern("(not(?=\s)|not(?=\()|-)").to_fsm()
assert fsm .accepts('-') == True
assert fsm .accepts('--') == False

Both of the above fail. I expect the first to succeed and the second to fail, because the final state for the second should end at the first '-'.

In contrast:

re.match('(not(?=\s)|not(?=\()|-)', '-') 
re.match('(not(?=\s)|not(?=\()|-)', '--') 

both of the above succeed (but the span for the second one is still (0, 1)

RevanthRameshkumar avatar Oct 01 '23 04:10 RevanthRameshkumar