View Full Version : Printing values from eregi_replace

04-11-2003, 05:47 PM
Right I have this piece of code which I use to validate web addresses.

$erg = "([a-zA-Z0-9]+){0,1}:(\\/){0,3}(www\.)?([a-zA-Z0-9\\-_\\@]+\\.)+([a-zA-Z0-9]+[\\.]?[a-zA-Z0-9]?){1}([\\/]?[\\.]?[a-zA-Z0-9]?[\\?]?){0,}";

if(eregi($erg,$myurl) == 1)
$myurl = eregi_replace($erg,'<a href="'.$myurl.'">'.$myurl.'</a>',$myurl);
echo $myurl;

I make it print out the URL when it is done. It works fine, until you put anything in the main address with a hyphen or equals (-,=) sign in it.

It then prints the link, plus everything after the hyphen. Can anyone tell me why?

04-13-2003, 09:59 PM
Dont worry! Sorted :D