Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
簡単な質問です。
次の文字列から sup タグとその中のすべてのコンテンツを削除したいと思います。
$string = "Priority Mail<sup>®</sup> International";
どうすればいいですか?
私はこのようなものがうまくいくと思います:
preg_replace("(<([a-z]+)>.*?</\\1>)is","",$input);
$string = preg_replace ("/<sup>(.*?)<\/sup>/i", "", $string);
(.*?) は \n または \r を処理できないことを知っておく必要があるため、最初にそれらをフィルター処理します。