Can someone help me modify the following function to allow referral strings in the URLs? This is a URL checker on a directory script IT will take URLS like www.mysite.com/?r=candy but not www.mysite.com/?r=13345 why would the alphas validate but not the numbers here is the function function is_url($urladdr) { $regexp = "^(https?://)"; // http:// $regexp .= "?(([0-9a-z_!~*'().&=+$%-]+:)?[0-9a-z_!~*'().&=+$%-]+@)?"; // username:password@ $regexp .= "(([0-9]{1,3}\.){3}[0-9]{1,3}"; // IP- 199.194.52.184 $regexp .= "|"; // allows either IP or domain $regexp .= "([0-9a-z_!~*'()-]+\.)*"; // tertiary domain(s)- www. $regexp .= "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\."; // second level domain $regexp .= "[a-z]{2,6})"; // first level domain- .com or .museum $regexp .= "(:[0-9]{1,4})?"; // port number- :80 $regexp .= "((/?)|"; // a slash isn't required if there is no file name $regexp .= "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; // filename/queries/anchors //qualified domain if (eregi( $regexp, $urladdr )) { // No http:// at the front? lets add it. if (!eregi( "^https?://", $urladdr )) $urladdr = "http://" . $urladdr; // If it's a plain domain or IP there should be a / on the end if (!eregi( "^https?://.+/", $urladdr )) $urladdr .= "/"; // If it's a directory on the end we should add the proper slash // We should first make sure it isn't a file, query, or fragment if ((eregi( "/[0-9a-z~_-]+$", $urladdr)) && (!eregi( "[\?;&=+\$,#]", $urladdr))) $urladdr .= "/"; return ($urladdr); } else return false; // The domain didn't pass the expression } Code (markup):