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

Clearer documentation for Re.eol #119

Open
hcarty opened this issue Sep 1, 2016 · 1 comment
Open

Clearer documentation for Re.eol #119

hcarty opened this issue Sep 1, 2016 · 1 comment

Comments

@hcarty
Copy link
Member

hcarty commented Sep 1, 2016

I would expect Re.split Re.(compile eol) "a\nb" to return ["a"; 'b"] but it returns ["a"; "\nb"] instead. If this is intended it would be nice to have this more clearly stated in the documentation.

@rgrinberg
Copy link
Member

This is because eol is more of a zero length assertion. You can use something like Re.(split (compile (char '\n'))) to get the behavior that you want.

I guess we can document which patterns are zero length and how Re.split treats those. I'll start with adding some tests to make sure that we don't accidentally touch this behavior however.

#120

mooreryan added a commit to mooreryan/ocaml-re that referenced this issue Dec 19, 2022
Adds a few examples of using zero-length patterns as inputs to Re.split.  Examples are taken from the test suite.  Related to ocaml#119 and ocaml#120.
mooreryan added a commit to mooreryan/ocaml-re that referenced this issue Feb 4, 2024
Adds a few examples of using zero-length patterns as inputs to Re.split.  Examples are taken from the test suite.  Related to ocaml#119 and ocaml#120.
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

2 participants