ocaml-re icon indicating copy to clipboard operation
ocaml-re copied to clipboard

Split on first occurrence of a pattern

Open hcarty opened this issue 9 years ago • 1 comments

let re = Re.compile @@ Re.first (Re.char '\n')
let result = Re.split re "a\nb\nc"

result is now ["a"; "b"; "c"] where I would have hoped for/expected ["a"; "b\nc"].

Is there a way to achieve this with Re?

hcarty avatar Dec 08 '16 18:12 hcarty

No, but a ?max parameter to the split functions would be a welcome addition.

rgrinberg avatar Dec 08 '16 22:12 rgrinberg