Re: Regular Expressions Help
| From: | CC Zona | Date: | Thu, 06 Jun 2002 04:32:15 +0000 |
| Subject: | Re: Regular Expressions Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100878@lists.php.net to get a copy of this message | ||
In article <3CFE2CA8.47C475E8@brocku.ca>, jyounker@brocku.ca (J. Younker)
wrote:
> Hi,
> I'm trying to use eregi_replace to check a user-submitted URL, but I
> keep getting the following error message:
> Warning: Invalid range end in /var/www/html/_db_db/db_input.php
> This what I'm using:
> $pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.-_?/&=])";
You've already gotten a working substitute using the superior preg_replace
function, but FWIW: the "invalid range" was caused by a misplaced hyphen.
In the middle of a character class, it delimits a range; to use it as a
literal, make it the last character in the character class.
--
CC