开发者

parsing regex csv with quotes as strings and non quotes as numbers

I'm trying to figure out a way to parse this CSV 开发者_如何学Gowith the following entry:

"So, can't believe someone, made this comma format", 77777, 3, 2, "the customer thought that this is "so brilliant!" to do."

The quotes represents strings and non-quotes represents integers. What makes this even more complex is there can be nested quotes and commas inside for the string. Is there a way to parse this and if so what would be the regex?

Thanks in advance!


It is possible to identify all the separator commas. But since you didn't say what programming language you are using so here is the one for Java:

(?:[0-9\"])[ ]*,[ ]*(?:[0-9\"])

It simply find comma that surround by either number or quote. Hope this help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜