サンプルコードがあります:
$array = array(
1 => "tag/gomobi.html",
2 => "game.html",
3 => "game.php",
4 => "game.html",
5 => "game/game-mobile/feed.html"
);
foreach ($array as $url) {
if(preg_match('/^((.*)\.html)(.*?)$/', $url, $matches)) {
echo $matches[1].'<br />';
}
}
しかし、結果は同じ値を削除できません (game.html)
tag/gomobi.html
game.html
game.html
game/game-mobile/feed.html
それを修正する方法、結果は次のとおりです。
tag/gomobi.html
game.html
game/game-mobile/feed.html