I am using Attoparsec which is said to backtrack by default. However, the following line:
parseOnly (string "foo" *> many1 anyChar <* string "bar") "fooxxxbar"
fails with:
Left "not enough input"
Why is that so? If many1 anyChar
decides to parse only three characters (xxx
) it should be successful. And it should consider doing that at some point because of backtracking, shouldn't it?
What is the proper way to do equivalent of /foo(.*)bar/
regex using Attoparsec?