C# 将标题标记转换为数字标记

C# 将标题标记转换为数字标记,c#,php,regex,html,C#,Php,Regex,Html,我想转换:(来自Wordpress) [caption id=“attachment_5433”align=“aligncenter”width=“413”] 星期二ế唐朝 [/说明] 对此:(html5) 新南威尔士州星期二ế唐朝 如何使用PHP或C#?尝试以下方法: $subject = preg_replace( '/\[caption[\s]{0,}(.*?)\][\s]{0,}(<a[\s]{0,}.*?<\/a>)[\s]{0,}(.*?)\[\/captio

我想转换:(来自Wordpress)

[caption id=“attachment_5433”align=“aligncenter”width=“413”]
星期二ế唐朝
[/说明]
对此:(html5)


新南威尔士州星期二ế唐朝
如何使用PHP或C#?

尝试以下方法:

$subject = preg_replace(
'/\[caption[\s]{0,}(.*?)\][\s]{0,}(<a[\s]{0,}.*?<\/a>)[\s]{0,}(.*?)\[\/caption\]/ims', 
'<figure $1> $2 <figcaption>$3</figcaption> </figure>',
$subject);
$subject=preg\u replace(

'/\[caption[\s]{0,}(.*?\][\s]{0,}(从阅读文档开始。这与您关于标题中图像的其他问题同时进行;)
<figure>
    <a href="http://baicadicungnamthang.net/uploads/2012/02/NSUT-Tuyet-Thanh.jpg"><img class=" wp-image-5433" title="NSUT-Tuyet-Thanh" src="http://baicadicungnamthang.net/uploads/2012/02/NSUT-Tuyet-Thanh.jpg" alt="NSƯT Tuyết Thanh" width="413" height="551"></a>
    <figcaption>NSUT Tuyết Thanh</figcaption>
</figure>
$subject = preg_replace(
'/\[caption[\s]{0,}(.*?)\][\s]{0,}(<a[\s]{0,}.*?<\/a>)[\s]{0,}(.*?)\[\/caption\]/ims', 
'<figure $1> $2 <figcaption>$3</figcaption> </figure>',
$subject);