Hi, I receive posts from an open moderated forum that need to be filtered for urls. I've successfully managed to trap any entires that use 'http://' 'www.' with the standard '.com' '.org', '.net' endings. What I need to do is to strip the prefix part ('http:// or http://www. or 'www') and suffix as well (the .com, etc.) I need only the domain name. I can't seem to trim away the suffix part. The code I've tried: $_POST['request'] = "aaaa. bbbb. The third has it all www.borko.worko.com and meanders on. Then it stops."; $check = $_POST['request']; if (preg_match("@^(?:www.)?([^/]+)@i", $check, $match)) { $host = $match[1]; (print "<br><div class='center'> <h4><br><br><br>URLs are not permitted <br><br> Click 'Back' on your browser and delete all URL references. </h4><br><br><br></div>"); /* EXTRA 1: Added to see what's happening */ print "<h4 style='color:green;'>$match[1]</h4><br><br"; /* END EXTRA 1 */ $boom = explode("www.", $host); foreach($boom as $key => $host){ $boom[$key] = $host; } $booms = implode("www.", $boom); $out = (preg_match('[.com]', $boom[1], $match)); /* EXTRA 2: Added to see what's happening */ echo "<b style='color:blue;'>The BOOM1 SPLIT Domain Name is:</b> {$boom[1]}<br><br><br>"; echo "<b style='color:green;'>The OUT SPLIT Domain Name is:</b> {$out}<br><br><br>"; /* EXTRA 2 */ What ouputs: Extra 1: "aaaa. bbbb. The third has it all www.borko.worko.com and meanders on. Then it stops." Extra 2 BOOM1 SPLIT: "borko.worko.com and meanders on. Then it stops." Extra 2 OUT SPLIT: nothing There's gotta be a better, simpler way of doing this. I want to check for the string in the POST. If it's there, tag it, and be able to save it, and re-enter just the domain back into future checks based on the IP address as well. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php