Ruby Split By Part of a Regex -
i have write argument parser, passed in string ala {a, b, c} delimiter comma space after it, can escaped pipe "|" before it. thinking of writing regex /[^\|], /
split by, , removing escape characters afterwards. when using split character before delimiter well.
how should go accomplishing i'm looking for?
if you're on version 1.9 of ruby, can split on /(?<!\|),/
.
(?<!\|)
negative lookbehind assertion meaning "ensure previous character not |
".
Comments
Post a Comment