Re: PCRE false match with preg_match?

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

 



When using "/([0-9]*)(.*)/i" it matches
substring 1: 7005
substring 2: -N/52

When using "/([0-9]*)\/(.*)/i" it matches
substring 1:
substring 2: 52

It looks to me as though its trying to match either or subgroup in order.

On 9/26/05, Jens Schulze <jens@xxxxxxxxxxxxxxxxxx> wrote:
> I recently encountered a strange behaviour, could someone please
> countercheck it, to either tell me there is an error in my pattern?
>
> I have a test string: "7005-N/52"
> I have two match patterns:      a) "/([0-9]*)\/(.*)/i"
>                                b) "/([0-9]*)\-(.*)/i"
> I check the test string with the help of preg_match, and they both
> matched, but normally variant a) shouldn't have matched.
>
> Normally I test my patterns with the tool "The Regex Coach", and
> according to this tool it shouldn't have matched.
> PHP version is 5.0.4, PCRE extension version is 4.5 01-December-2003
>
> Thanks for any help or feedback,
> Jens
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
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