<?php
$html = <<<HTML
税务调查。
[caption id="attachment_111" align="aligncenter" width="100"]<img src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="拜登与儿子。" width="100" height="100" class="size-full wp-image" /> 拜登与儿子。[/caption]
他在声明中说:“我会非常认真地调查,往来。”
<img src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="拜登总统" width="100" height="100" class="aligncenter size-full wp-image" />
<div style="position:relative; overflow:hidden"> <iframe src="https://cdn.google.com/players/VM.html" width="100" height="100" frameborder="0" scrolling="auto" title="大促销 拜登的美国" style="position:absolute;"></iframe> </div>
<iframe style="border: none; overflow: hidden;" src="https://www.facebook.com/plugins/video.php?height=100&href=https%3A%2F%2Fwww.facebook.com;width=100&t=0" width="100" height="100" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
<iframe src="https://www.facebook.com/plugins/video.php?height=400&href=https%3A%2F%2&show_text=false&width=100&t=0" width="100" height="100" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share" allowFullScreen="true"></iframe>
<b>更多热点</b>
<p>halo拜登也指美国经济不会衰退</p>
<figure id="attachment_279" style="width: 100px" class="wp-caption alignnone"><img class="size-full wp-imag" src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="修理厂商总会拜登城" width="100" height="100" /><figcaption class="wp-caption-text">修理厂商总会拜登城</figcaption></figure>
<a href="http://google.com">go to google</a>
<span style="color: #ff6600;"><strong>另外,拜登声明中说</strong></span>
HTML;
$tags = ["拜登", "认真"];
$blacklisted = implode(
'|',
array_map(
fn($tag) => "<{$tag}[ >].+?" . ($tag === 'img' ? "/>" : "</$tag>"),
['a', 'img', 'iframe', 'figure', 'figcaption']
)
);
echo preg_replace(
sprintf('~(?:\[caption[ \]].+?\[/caption]|%s)(*SKIP)(*FAIL)|%s~us', $blacklisted, implode('|', $tags)),
'<span class="article-tag"><a class="mytag" href="http://outside.com">$0</a></span>',
$html
);
- Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- 税务调查。
[caption id="attachment_111" align="aligncenter" width="100"]<img src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="拜登与儿子。" width="100" height="100" class="size-full wp-image" /> 拜登与儿子。[/caption]
他在声明中说:“我会非常<span class="article-tag"><a class="mytag" href="http://outside.com">认真</a></span>地调查,往来。”
<img src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="拜登总统" width="100" height="100" class="aligncenter size-full wp-image" />
<div style="position:relative; overflow:hidden"> <iframe src="https://cdn.google.com/players/VM.html" width="100" height="100" frameborder="0" scrolling="auto" title="大促销 拜登的美国" style="position:absolute;"></iframe> </div>
<iframe style="border: none; overflow: hidden;" src="https://www.facebook.com/plugins/video.php?height=100&href=https%3A%2F%2Fwww.facebook.com;width=100&t=0" width="100" height="100" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
<iframe src="https://www.facebook.com/plugins/video.php?height=400&href=https%3A%2F%2&show_text=false&width=100&t=0" width="100" height="100" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share" allowFullScreen="true"></iframe>
<b>更多热点</b>
<p>halo<span class="article-tag"><a class="mytag" href="http://outside.com">拜登</a></span>也指美国经济不会衰退</p>
<figure id="attachment_279" style="width: 100px" class="wp-caption alignnone"><img class="size-full wp-imag" src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="修理厂商总会拜登城" width="100" height="100" /><figcaption class="wp-caption-text">修理厂商总会拜登城</figcaption></figure>
<a href="http://google.com">go to google</a>
<span style="color: #ff6600;"><strong>另外,<span class="article-tag"><a class="mytag" href="http://outside.com">拜登</a></span>声明中说</strong></span>
- Output for 7.3.0 - 7.3.2
- Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' in /in/KgAYA on line 33
Process exited with code 255.
preferences:
115.15 ms | 401 KiB | 123 Q