Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing values from eregi_replace

    Right I have this piece of code which I use to validate web addresses.

    PHP Code:
    $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?

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Dont worry! Sorted


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •