On Thursday, July 25, 2002, Michael Sims wrote:

> On Thu, 25 Jul 2002 15:05:36 +0200, you wrote:

>> for example:
>> $mem='this is a test';
>> preg_match('/test/', ...) should return me somehow: 10

> How about this:

> $mem='this is a test';

> if(preg_match("/(.*)test/",$mem,$matches)) {
>   echo strlen($matches[1]);
> }

> Of course, if "test" occurs more than once then the above won't
> work, since regex's are "greedy"...

If you add a ? after the * then that'll make it non-greedy won't it?

-- 
Tim Fountain ([EMAIL PROTECTED])
http://www.tfountain.co.uk/


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

Reply via email to