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

Add examples for Re.split function #216

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mooreryan
Copy link

Adds a few examples of using zero-length patterns as inputs to Re.split. Examples are taken from the test suite. Related to #119 and #120.

I know it is an old issues (this one: #119), but I also tried to use the eol as input for split in the past. So, I took a couple of the test cases and added them to the examples for Re.split.

@mooreryan
Copy link
Author

Looks like the build is failing due to the dependency on core_bench for the benchmarks.

@@ -280,6 +280,22 @@ val split : ?pos:int -> ?len:int -> re -> string -> string list
# Re.split ~pos:3 regex "1,2,3,4. Commas go brrr.";;
- : string list = ["3"; "4. Commas go brrr."]
]}

Be careful when using [split] with zero-length patterns like [eol], [bow],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you should explain what to be careful about, as it's kind of vague even with the examples. I get the general idea, but I think this could be explained in more detail.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added more details in the latest commit.

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

Successfully merging this pull request may close these issues.

None yet

2 participants