Re: preg_match too greedy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/29/2009 07:48 PM, Daniel Kolbo wrote:

code works (no match) for me too on php 5.2.6 build date May 2 2008
18:01:20 with dumbdows NT.

preg_match fails but for a reason other than what I think you may be
expecting.  It fails b/c of the first forwards slash in $url.  The regex
engine doesn't even get past the second character let alone reaching the
end of line anchor.

The forward slash shouldn't be an issue as the delimiter is '%'. The full pattern is:

%^/foo/?$%U


Also, your code works (no match) with this first forward slash removed:
$url = 'foo(/)?'

But the string happens to start with a forward slash.


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux