C# Regex Split - commas outside quotes
var result = Regex.Split(samplestring, ",(?=(?:[^\"]*\"[^\"]*')*[^\"]*$)");
I have problems to understand how it works.
Specifically, I don't know what the * matches here?
",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)")
^
Does it mean
there are 0 or more of (?=(?:[^\"]*\"[^\"]*')
update for a sample input
2,1016,7/31/2008 14:22,Geoff Dalgas,6/5/2011 22:21,http://stackoverflow.com,"Corvallis, OR",7679,351,81,b437f461b3fd27387c5d8ab47a293d35,34
Use the following code to test:
string samplestring = "2,1016,7/31/2008 14:22,Geoff Dalgas,6/5/2011 22:21,http://stackoverflow.com,\"Corvallis, OR\",7679,351,81,b437f461b3fd27387c5d8ab47a293d35,34";