regex-applicative icon indicating copy to clipboard operation
regex-applicative copied to clipboard

findAll

Open mizlan opened this issue 3 years ago • 1 comments

would it be possible to have a findAll method that returns all matches in a string?

mizlan avatar Dec 14 '22 04:12 mizlan

I think this works? (warning: it may not work) It is meant to be like in other languages' behavior where the matches are non-overlapping.

findAll :: RE s a -> [s] -> [a]
findAll = unfoldr . findFirstPrefix . (few anySym *>)

If you'd like I can write some tests and make a PR :)

mizlan avatar Dec 14 '22 19:12 mizlan