Re: Regex error

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

 






On Wed, March 14, 2007 7:56 pm, jekillen wrote:
> Hello;
> The following regex:
>
> ereg("<member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})'
> id='$m[1]'>", $groups, $m1);
>
> is causing the following error:
>
> Warning: ereg() [function.ereg]: REG_ERANGE in <path info>_proc.php on
> line 81
>
> Can someone tell me what this means?

You used to have the - after the 9 at the end, and then you tacked on
the \. and \/ after that, and now PCRE is trying to use the - as if it
were a range-specifier, like, a-z or 0-9, only you've got,
essentially, a-z0-9-.

This makes no sense at all, as it sort of means 'a to z'  or '0 to 9'
or, umm, '9 to .' or something like that, only not.

Move the - to the END of the pattern, right after the \/

PS
Technically, \ is a special character inside of quotes in PHP, as well
as an escape character for PCRE, so you really should use \\. and \\/

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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