I'm trying to grab the 12345 out of the following URL using preg\_match.

```
$url = "http://www.somesite.com/directory/12345-this-is-the-rest-of-the-url.html";

$beg = "http://www.somesite.com/directory/";
$close = "\-";
preg_match("($beg(.*)$close)", $url, $matches);

```

I have tried multiple combinations of . \* ? \b

Does anyone know how to extract 12345 out of the URL with preg\_match?