Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findAll #47

Open
mizlan opened this issue Dec 14, 2022 · 1 comment
Open

findAll #47

mizlan opened this issue Dec 14, 2022 · 1 comment

Comments

@mizlan
Copy link

mizlan commented Dec 14, 2022

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

@mizlan
Copy link
Author

mizlan commented Dec 14, 2022

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant