ocaml-re
ocaml-re copied to clipboard
Split on first occurrence of a pattern
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?
No, but a ?max parameter to the split functions would be a welcome addition.