Re: Regular Expressions Help

From: Date: Wed, 05 Jun 2002 19:19:37 +0000
Subject: Re: Regular Expressions Help
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-100772@lists.php.net to get a copy of this message
Thanks, Jim! That's exactly what I needed. J. Jim Lucas wrote: > not sure why you have such a complex reg there, but will this work for you. > > preg_replace("/(http:\/\/)?([^\/ ]*)(.*);/", > "http://\\2\\3", $str); > > \\1 = http:// ; if there > \\2 = domain > \\3 = request_uri > > Jim Lucas > ----- Original Message ----- > From: "J. Younker" <jyounker@brocku.ca> > To: <php-general@lists.php.net> > Sent: Wednesday, June 05, 2002 8:22 AM > Subject: [PHP] Regular Expressions Help > > > 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:]\.-_?/&=])"; > > $replace = "http://\\2\\3"; > > $URL = eregi_replace($pattern, $replace, $URL); > > I've stared at this expression for too long and can't figure out what's > > wrong. > > Thanks, > > J. Younker > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

« previous php.general (#100772) next »