问 [img]xxx[/img]改为<img scr="xxx"> 正则表达式怎么写
将
[img]xxxx[/img]改为
<img scr= "xxxx ">
的正式表达怎么写, 谢谢解答!
------解决方案--------------------string str = @ "[img]xxxx[/img] ";
string r = @ "\[[/]?img\] ";
str = @ " <img scr= " " "+System.Text.RegularExpressions.Regex.Match(str, r).ToString()+@ " " "> ";
------解决方案--------------------try
string yourStr = ..............;
string resultStr = Regex.Replace(yourStr, @ "\[img\]([^\[]*?)\[/img\] ", @ " <img src= " "$1 " " border= " "0 " "> ", RegexOptions.IgnoreCase);