Filter an IP address
The cheap and dirty:
preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $string, $result);
The best way:
filter_var($var, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
filter_var($var, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);

Parsing/handling a URL
parse_url('http://username:password@hostname/path?arg=value#anchor');
Returns something way more useful
Array
(
[scheme] => http
[host] => hostname
[user] => username
[pass] => password
[path] => /path
[query] => arg=value
[fragment] => anchor
)

More added as it becomes available…