- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$s = 'blah blah http://localhost:80/somedir/somedir2/i-want.this: blah';
preg_match('(http.*/(.*?):.*$)', $s, $m);
var_dump($m);
preg_match('(http.*?/(.*?):.*$)', $s, $m);
var_dump($m);