diff --git a/lib/core.mli b/lib/core.mli index 6ee39500..715ef523 100644 --- a/lib/core.mli +++ b/lib/core.mli @@ -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], + and [eow]. + + {[ + # Re.split (Re.compile Re.eol) "a\nb";; + - : string list = ["a"; "\nb"] + + # Re.split (Re.compile Re.bow) "a b";; + - : string list = ["a "; "b"] + + # Re.split (Re.compile Re.eow) "a b";; + - : string list = ["a"; " b"] + ]} + + Note the position of the [\n] and space characters in the output. *) val split_gen : ?pos:int -> ?len:int -> re -> string -> string gen