preg_matchを使用して、次のURLから12345を取得しようとしています。PHP 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);
私は複数の組み合わせを試しました。 *? \ b
preg_matchでURLから12345を抽出する方法を知っている人はいますか?
ありがとう、完璧に動作します! – Mark