fork download
  1. <?php
  2.  
  3. $re = '/^http(?:s)?:\/\/\K([^\/]+\/[^\/]+\/).*$/m';
  4. $str = 'http://e...content-available-to-author-only...e.com/a/b/c.php';
  5. preg_match($re, $str, $matches);
  6. echo $matches[1];
  7.  
  8. ?>
Success #stdin #stdout 0.01s 82944KB
stdin
Standard input is empty
stdout
example.com/a/