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

Behavior or Re.Pcre.split when only separators are found #288

Open
elboulangero opened this issue Jun 6, 2024 · 0 comments · May be fixed by #538
Open

Behavior or Re.Pcre.split when only separators are found #288

elboulangero opened this issue Jun 6, 2024 · 0 comments · May be fixed by #538
Labels

Comments

@elboulangero
Copy link

I observe this behavior (Debian Sid, re 1.11.0):

utop # let whitespace_re = Re.Pcre.regexp "\\s+";;
val whitespace_re : Re.re = <abstr>

utop # Re.Pcre.split ~rex:whitespace_re ("");;
- : string list = []

utop # Re.Pcre.split ~rex:whitespace_re (" ");;
- : string list = [""]

Is it the expected behavior? In the second case I would have expected [] instead of [""].

For comparison, here's what I get with the pcre library:

utop # Pcre.split ("");;
- : string list = []

utop # Pcre.split ("  ");;
- : string list = []

Thanks

@elboulangero elboulangero changed the title Behavior or Re.Pcre.Split when only separators are found Behavior or Re.Pcre.split when only separators are found Jun 6, 2024
rgrinberg added a commit that referenced this issue Sep 7, 2024
rgrinberg added a commit that referenced this issue Sep 7, 2024
@rgrinberg rgrinberg added the pcre label Sep 20, 2024
vouillon added a commit that referenced this issue Oct 18, 2024
An occurrence of the delimiter at the beginning or at the end of the
string is ignored.

Fixes #288, fixes #411.
@vouillon vouillon linked a pull request Oct 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants