实现支持逻辑搜索/单词搜索/词组搜索+支持OR/AND关键字的VBS CL

2019-04-02 21:14:08于丽

        Dim re1
        Dim re2
        Dim re3
        Dim str
        Dim str1
        Dim a1
        Dim a2
        Dim a3
        Dim a4
        str  = strField & " like '%"
        str1 = "%'"
        With objReg
            .Pattern = "^(.+)s(and|or)s"
            re       = .Test( strText )
            .Pattern = "s(and|or)s(.+)$"
            re3      = .Test( strText )
        End With
        If re And re3 Then
            If CheckYes( "^((S*S) (borb|bandb) (S*S)) (and|or) ((S*S) (borb|bandb) (S*S))$" , 6 ) Then
                check = False
            Else
                With objNode2
                    a1    = .submatches(0)
                    a2    = .submatches(2)
                    a3    = .submatches(4)
                    a4    = .submatches(6)
                    check = "(" & str & a1 & str1 & " " & .submatches(1) & " " & str & a2 & str1 & ") " &_