【发布时间】:2015-02-21 20:23:06
【问题描述】:
使用http://www.regexr.com/ 模式进行测试\"([\s\S]*?)\" 可以匹配我的目标字符串。但是,在我的代码中,我得到一个类型不匹配并且不知道为什么,IDE 改变了字符串在引号内的格式
Dim Matches
Dim objectRegularExp As RegExp
If Application.FileDialog(msoFileDialogOpen).Show <> -1 Then Exit Sub
FileName = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
Open FileName For Input As #1
yourText = Input(LOF(1), #1)
Close #1
LengthOfFile = Len(yourText)
'create regular expression
Set objectRegularExp = New RegExp
With objectRegularExp
.Pattern = "" \ "(\s\S*?)\""" <type mismatch runtime error
.Global = True
.MultiLine = True
End With
Set Matches = objectRegularExp.Execute(yourText)
【问题讨论】: