ocaml-re
ocaml-re copied to clipboard
Clearer documentation for Re.eol
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.
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