View Single Post
  #1 (permalink)  
Old 11-19-04, 06:07 PM
CMIVXX's Avatar
CMIVXX CMIVXX is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Angry Regular Expression IP Address Replacement

OK, I have this wonderful regular expression that replaces IP addresses in a variable. The catch is that I want to replace the IP address with the same IP address, just with a link around it that you can click on for further information.

On the example below, I need to replace the $ip with the actual IP address from the expression.

$msg = ereg_replace("([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})", "<a href=\"script.php?$ip\">$ip</a>", $msg);

Can anyone help me?
Reply With Quote