Jim Lucas wrote:
>> I expected 'no match' but get 'match'.
> cut/paste your code and it works for me.
Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What
version do you have?
If I might suggest a couple of simplifications that would make it easier to
>> $url = '/foo(/)?';
I don't think you need parentheses around your second forward-slash. If you had
multiple characters that were optional you'd want to group them in parentheses,
but here I think it just makes the regex harder to read.
>> echo (preg_match($pattern, $test) != false)
The " != false " here is redundant. Combined with the ternary operator, the
logical switchbacks make me a little dizzy (especially this close to lunchtime).
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php