- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$expr = '#[a-z][a-z0-9.]*://(?:[^:@]+(?:[^@]+)?@)?[^:/]+(?::[0-9]+)?/([^/]+)#';
$str = 'http://dontmatchthis.local/butmatchthisplease';
preg_match($expr, $str, $matches);
var_dump($matches);