-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
This appears to be similar to #7, but since it happens in 1.1.0.0, I thought you might have overlooked something.
ghci> "aaxxc" & [regex|aax(b)?x(c)|] . group 0 .~ "B"
"Baaxxc"
ghci> "aaxxc" & [regex|(aa)x(b)?x(c)|] . group 1 .~ "B"
"aaBxxc"
When the optional group is the last one, nothing is changed:
ghci> "aaxxc" & [regex|(aa)x(b)?xc|] . group 1 .~ "B"
"aaxxc"
Like in the other issue, making the optional group non-capturing and wrapping it in a new group works around the issue:
ghci> "aaxxc" & [regex|(aa)x((?:b)?)xc|] . group 1 .~ "B"
"aaxBxc"
No worries if this is too awkward to implement reliably, the workaround is tolerable 🙂
Metadata
Metadata
Assignees
Labels
No labels