positive: 在写代码时,从文件读入一些字符串类型的数据,要与一个字符串判断是否相同,明明两个字符串内容相等,但是我们用if判断时,两者却不等,这个原因或许就是从文件读入的那些字符串是带双引号的, 处理方法,就是在if...
negative: "'正则<br>Function RegExp(text As String, reg As String) As String<br>Dim mRegExp As Object '正则表达式对象<br>Dim mMatches As Object '匹配字符串集合对象<br>Dim mMatch As Object '匹配字符串<br>RegExp = """"<br>Set mRegExp = CreateObject(""Vbscript.Regexp"")<br>With mRegExp<br>.Global = True 'True表示匹配所有, False表示仅匹配第一个符合项<br>.IgnoreCase = True 'True表示不区分大小写, False表示区分大小写<br>.Pattern = reg '匹配字符模式 "".*[款].*[号][\d]+[、](.*)""<br>SetmMatches = .Execute(text) '执行正则查找,返回所有匹配结果的集合,若未找到,则为空<br>For Each mMatch In mMatches<br>If (Not mMatch.SubMatches(0) = """") Then<br>RegExp = Trim(mMatch.SubMatches(0))<br>End If<br>Next<br>End With<br>Set mRegExp = Nothing<br>Set mMatches = Nothing<br>End Function"