Function DelQuote(strContent)
If IsNull(strContent) Then Exit Function
Dim re
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="\[quote\](.[^\]]*?)\[\/quote\]"
strContent= re.Replace(strContent,"")
re.Pattern="\
Quote: (.[^\
]*)\](.[^\]]*?)\[\/quote\]"
strContent= re.Replace(strContent,"")
Set re=Nothing
DelQuote=strContent
End Function
请问以上这段代码要转成VB.NET要怎么写啊??只要是正则表达式转换的时候出错了,其它的没什么问题的~在线等~~

解决方案 »

  1.   

    ***=@"\[quote\](.[^\]]*?)\[\/quote\]";
    加个@号
      

  2.   

    能否详细点呢~Set re=new RegExp 在VB.NET里没有这个东东的,不知道该怎么写~
      

  3.   

    Function DelQuote(ByVal strContent As String) As String
        If (strContent = Nothing) Then Exit Function
        System.Text.RegularExpressions.Regex.Replace(strContent, "\[quote\](.[^\]]*?)\[\/quote\]", "", RegexOptions.IgnoreCase)
        System.Text.RegularExpressions.Regex.Replace(strContent, "\
    Quote: (.[^\
    ]*)\](.[^\]]*?)\[\/quote\]", "")
        DelQuote = strContent
    End Function
      

  4.   

    如果有引入命名空间
    Imports System.Text.RegularExpressions
    就不用写全
    Function DelQuote(ByVal strContent As String) As String
        If (strContent = Nothing) Then Exit Function
        Regex.Replace(strContent, "\[quote\](.[^\]]*?)\[\/quote\]", "", RegexOptions.IgnoreCase)
        Regex.Replace(strContent, "\
    Quote: (.[^\
    ]*)\](.[^\]]*?)\[\/quote\]", "")
        DelQuote = strContent
    End Function另外,不知道你给的代码中的Global是什么意思,所以可能会有问题