+ -
当前位置:首页 → 问答吧 → 请问用正则表达式如何过虑[font *****] ****]*[ [/font]中的[font]标签

请问用正则表达式如何过虑[font *****] ****]*[ [/font]中的[font]标签

时间:2011-09-24

来源:互联网

我想要[font *****] ****]*[ [/font]中的 ****]*[ 内容就是把[font]标签过虑掉 中间的内容按原来显示(包括[]标签)

作者: paomoer   发布时间: 2011-09-24

JScript code

    var str = '[font *****] ****]*[ [/font]';
    var re = /\[[^\[]+?\]/gi;
    str = str.replace(re,'');
    alert(str)




楼主试试

作者: calmcrime   发布时间: 2011-09-24

\[[^\]]*?\].*?\[[^\]]*?\]

作者: liukai625   发布时间: 2011-09-24

C# code
string str = @"[font *****] ****]*[ [/font]";
        Regex re = new Regex(@"(?is)\[font\s+[^]]+\](.*?)[[^[]/font]");
        foreach (Match ma in re.Matches(str))
        {
            Response.Write(ma.Groups[1].Value);
        }
        /*
         输出
        ****]*[ 
        */

作者: soonfei   发布时间: 2011-09-24

相关阅读 更多

热门下载

更多