I have following string:
“Johnny Test” <johnny@test.com>,Jack <another@test.com>,“Scott
Summers” <scotts@test.com> …
The multi word names are enclosed in double quotes
I need an array with containing the following result:
array(
array('nom' => 'Johnny Test', 'adresse' => 'johnny@test.com'),
array('nom' => 'Jack', 'adresse' => 'another@test.com'),
array('nom' => 'Scott Summers', 'adresse' => 'scotts@test.com')
...
)
something like this should work.
If you have
\r\ninside the string use this before parsing it with the regex:UPDATE: Code I’m using to test this.
test_preg2.php:
Output:
UPDATE 2: the string has been formated with htmlentities(). (the sample string of the question is wrong man…)