How can I split a string only once, i.e. make 1|Ceci n\'est pas une pipe: | Oui parse to: [\"1\", \"Ceci n\'est pas une pipe: | Oui\"]?
1|Ceci n\'est pas une pipe: | Oui
[\"1\", \"Ceci n\'est pas une pipe: | Oui\"]
The
use the javascript regular expression functionality and take the first captured expression.
the RE would probably look like /^([^|]*)\|/.
/^([^|]*)\|/
actually, you only need /[^|]*/ if you validated that the string is formatted in such a way, due to javascript regex greediness.
/[^|]*/