On Fri, 2007-08-17 at 12:00 -0500, Jay Blanchard wrote:
> Given the string 'foo''bar''glorp' (all quotes are single quotes)I had
> hoped to find a regular expression using preg_match that would return an
> array containing just those words without having to go through
> additional gyrations, like exploding a string to get an array. I have
> only had limited luck
> 
> $theString = "'foo''bar''glorp'";
> preg_match( "/\'(.*)\'/", $theString, $matches);
> print_r($matches);

You want to add the ungreedy modifier...

preg_match( "/\'(.*)\'/U", $theString, $matches);

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

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

Reply via email to