On Fri, 10 Sep 2004 16:41:56 +0300, Robin Vickery <[EMAIL PROTECTED]> wrote:
> On Fri, 10 Sep 2004 11:43:54 +0200, Wouter van Vliet
> <[EMAIL PROTECTED]> wrote:
> >
> > For my own reasons (can explain, would take long, won't till sbody
> > asks) I want to match a quoted string within a string. That is somehow
> > kind of easy, I know ... if it weren't for the slashing of quotes.
> 
> The standard perl regexp for matching double-quote delimited strings is this:
> 
>    /"([^"\\]|\\.)*"/
> 
> which copes nicely with escaped characters. You'll probably need to
> double up the backslashes in php.
> 
>   $regex = '/"([^"\\\\]|\\\\.)*"/';
> 

Strawberryjuice on earth, I was expecting something very easy - but
this beats it all. Changed it a little, for it to also find 
single-quote delimited strings:

/( "([^"\\]|\\.)*" | '([^'\\]|\\.)*' )/x

works like a coconut!

Thanks a lot!
Wouter

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

Reply via email to