Regex for extracting quoted strings
| From: | Mark Kelly | Date: | Sat, 05 Mar 2011 15:26:32 +0000 |
| Subject: | Regex for extracting quoted strings | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-311696@lists.php.net to get a copy of this message | ||
Hi.
I'm hoping someone can help me extract text between double quotes from a
string.
$regex = 'some magic';
$r = preg_match($regex, $sentence, $phrases);
So, if
$sentence = 'Dave said "This is it". "Nope, that is the wrong colour" she
replied.';
I want $phrases to contain 'This is it' and 'Nope, that is the wrong colour'.
Can anyone help?
Cheers,
Mark