<script>
var s = "http://www.dom.com/path/a/index.php?id=3";
alert(s.replace(/(http:[/]+[^/]+)([/].+[/])([^/]+)/,"$2"));
</script>
var s = "http://www.dom.com/path/a/index.php?id=3";
alert(s.replace(/(http:[/]+[^/]+)([/].+[/])([^/]+)/,"$2"));
</script>
var result=url.match(/[^/]([/][^/].*[/])/);
result=result?result[1]:"";