有字符串:[4,7]>0 and [1,4]<1 and [7,8]<>"" and ([5,6]=0 or[3,4]>2)[]的个数可能会有上万个,用最高的办法把[]和中的内容转成1,[]中的内容不用管
最后的结果:1>0 and 1<1 and 1<>"" and (=0 ro 1>2)
--------
www.vicmiao.com
努力就有美好时光!

解决方案 »

  1.   

    呵,这就不好办了。------
    www.vicmiao.com
    努力就有美好时光!
      

  2.   

    Private Sub Command1_Click()
    Dim Reg As New RegExp
    Dim strSource As String, strReplace As String
    Dim strPattern As String
    strSource = "[4,7]>0 and [1,4]<1 and [7,8]<>1 and ([5,6]=0 or[3,4]>2)"strReplace = "1"
    strPattern = "\x5b\d,\d\x5d"
    Reg.Pattern = strPatternWhile Reg.Test(strSource) = True
    strSource = Reg.Replace(strSource, strReplace)
    WendMsgBox strSource End Sub
      

  3.   

    强啊,牛人。-----
    www.vicmiao.com
    努力就有美好时光!