0

Given is a csv-string that contains an unknown number of blocks of text, splitted by semicolons (;).

Sometimes, but not always, the text blocks are enveloped in quotation marks ("). If they are, then semicolons may appear in the text block.

I am looking a regular expression to extract the text blocks from the string, using either preg_match_all or preg_split.

I can handle basic regular expressions, but when it comes to lookahead/lookbehind, it is simply beyond me. Especially how to prevent semicolons which are enveloped by quotation marks is a problem I simply do not have any idea how to put in a regular expression.

The programming language I use is php.

Every help is very much appreciated.

Majiy
  • 1,890
  • 2
  • 24
  • 32

1 Answers1

0

You should try out this function http://php.net/manual/en/function.fgetcsv.php