I have the following row in my CSV file
,1,193,23 Video,,"Slotsgade 2, 2.th",,,,,,Copenhagen N,,DK-2200,Denmark,,,,,,,,
,,,Europe,+45 31450980,,info@23company.com,www.23video.com,,,,,,,,Cabsat Online
Video Industry Sourcebook 12,Mr.,Kristoffer,,Schou,,M,,,,,,,,,,,,,,,,,,,,,,,,,
,,,schou@23company.com,,,,,,,
As you can see
"Slotsgade 2, 2.th"
has a comma in between, now I am using preg_split
to explode the row in columns.
Could anyone suggest me a regular expression which skips the comma in between double quotes
I have tried this already:
/,|".*(?=")/
What is the regular expression that I can use in preg_split
to get the data correctly?
Use the fgetcsv function, it will deal it for you.
And you also have str_getcsv, which will parse a CSV string into an array.