[TxMt] Re: Regular expression conundrum (CSV)

Jacob Rus jrus at hcs.harvard.edu
Mon Feb 26 00:17:37 UTC 2007


James Edward Gray II wrote:
> I can tell you from experience that it's impossible to correctly parse 
> all valid CSV with just one regular expression.  The second edition of 
> Mastering Regular Expressions gives an example pattern that gets very 
> close, but I've found edge cases it fails on.

Well, that's not quite accurate.  There is no single 'csv' spec, so 
there is no bright line between 'valid' and 'invalid' csv here.  Most 
people try to conform to what MS Excel does (excel being the 800 pound 
gorilla in the spreadsheet market), but many other apps/people make csv 
that is close to, but not quite, the same as the excel format.

-Jacob




More information about the textmate mailing list