私はほとんどそこにいます!
これが私が調整しようとしている文字列と私の preg_replace の試みです。
$description_string = '<p>Here is the test link: <a href="http://www.youtube.com/watch?v=2MFn8L9tIrg" target="_blank">“Man or Muppet”</a> with other text afterwards.</p>';
$description = preg_replace( '/(<a[^>]+youtube[^>]*>)+[^"]*(<\/a>)+/', '$0Watch This Video$2', $description );
私が得ている結果は間違っています:
テスト リンクは次のとおりです。「Man or Muppet」後で他のテキストとともにこのビデオをご覧ください。
どんな助けでも大歓迎です!ありがとう!