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

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -