Split a string by commas but ignore commas within double-quotes using Javascript gives the regexp /(".*?"|[^",\s]+)(?=\s*,|\s*$)/
. How to get use it in Erlang re:split()
? The regexp doesn't work with Erlang.
1> S = "20140419,\"Blah blah, foo foo\",1,0,0,0,1,2,0,0".
2> re:split(S, "(\".*?\"|[^\",\s]+,)(?=\s*,|\s*$)", [{return,list}]).
["20140421,","\"Blah blah, foo foo\"",",1,0,0,0,1,2,0,0"]
The result I'm looking for is the list
["20140421","\"Blah blah, foo foo\"","1","0","0","0","1","2","0","0"]
Thanks.