Hello, everyone, I have this regex which matches full and partial URLs and converts them to links:
$regex = '(http(s?)://)?(([[:alpha:]]+\.)+(com|org|edu|net|gov)(/[^[:space:]]*)?)';
$text = eregi_replace($regex, "<a href=\"http\\2://\\3\" target=\"_blank\">\\1\\3</a>", $text);
Now I need to modify it so that if there is an @ before the partial URL, it does not match. (I have a separate eregi_replace() for doing emails, obviously). I tried adding (?<!@) right before the first set of ((. (Also, then my \3 change to \4) When I did this, it gives me the error: Warning: eregi_replace() [function.eregi-replace]: REG_BADRPT in /srv/test/htdocs/convert_urls/convert.php on line 33. Any ideas what I'm doing wrong?
Thanks,
Jonathon Reinhart