On 03/05/2011 09:26 AM, Mark Kelly wrote:
> 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

$regex = '/"([^"]+)"/';

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to