Don't loose this regex
I really wish I knew where I found this... but after only an hour of digging in my old code, I found the regex to deal with CSV files (that is, handle both quoted and non-quoted values, commas in quoted values, etc).
I know I didn't write the regex pattern. I also know I don't want to lose this and have to try.
Regex rex = new Regex(",(?=([^\"]*\"[^\"]*\")*(?![^\"]*\"))");
string values = rex.Split( csvLine );
foreach( string v in values)
If you have an attribution for me, please let me know. I'd like to give credit to the regex author.
[update] - yes, it was from here : http://radio.weblogs.com/0117167/2003/02/18.html#a132 (that's from Early and Adopter) (thanks, !)
[cross-posted from Philip Rocks, Philip Rieck's new-ish real blog - http://philiprieck.com/blog/]