开发者

need a regex to parse a csv file with double quotes in php

开发者 https://www.devze.com 2023-02-03 11:01 出处:网络
Tr开发者_JAVA百科ying to parse a csv file that has all the data wrapped in double quotes, because there may be commas in the double quotes.

Tr开发者_JAVA百科ying to parse a csv file that has all the data wrapped in double quotes, because there may be commas in the double quotes.

Looks like this:

$songs = '"1, 2, 3, 4 (I Love You)","Plain White T's","CBE10-22",15,"CBE10-22","","","CB",984,"","10/05/10"';

$regResult = preg_match( "", $songs, $matches );

I can't figure out a regex that will return the data between the quotes as the matches. I'm sure there is some regex master that can help me with this.


you dont need no stinkin regex to parse a csv file in php.

see fgetcsv() and str_getcsv()

0

精彩评论

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

关注公众号