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
Open

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

elboulangero opened this issue Jun 6, 2024 · 0 comments
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants