ドメインを(preg_matchで)一致させたいのですが、サブドメインを除外したいのです。
例boon.example.orgを除くexample.orgのすべてのサブドメインを照合したい:
私はこれを試しました:
$test = "boon.example.org";
$test2 = "null";
if(preg_match('#(?!boon)(\w+\.)?example\.org#', $test, $output)) {
$test2 = $output[2] .'example.org';
}
ただし、test2の出力は次の とおりです。example.orgではなくoon.example.org
誰かが答えを持っていますか?