[TxMt] Regular expression conundrum (CSV)

James Edward Gray II james at grayproductions.net
Thu Feb 22 17:33:52 UTC 2007

On Feb 22, 2007, at 11:18 AM, Fritz Anderson wrote:

> I'm out of ideas. Does anybody have a suggestion?

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.

You can do it with as little as two regular expressions though.  If  
you want to see how, you can examine the source of my FasterCSV Ruby  


It is a regular expression based parser.

James Edward Gray II

More information about the textmate mailing list