Function mymid(myString As String, myPattern As String)
''Create objects.
Dim objRegExp As RegExp
Dim colMatches 'As MatchCollection
Dim RetStr As String '' Create a regular expression object.
Set objRegExp = New RegExp ''Set the pattern by using the Pattern property.
objRegExp.Pattern = myPattern '' Set Case Insensitivity.
objRegExp.IgnoreCase = True ''Set global applicability.
objRegExp.Global = True ''Test whether the String can be compared.
If (objRegExp.Test(myString) = True) Then
Set colMatches = objRegExp.Execute(myString)
RetStr = colMatches(0).Value
Else
RetStr = ""
End If
mymid = RetStr
End Functionstr=mymid("asd#gfhg#jf", "#(.+?)#")
//得到的是#gfhg#,我想得到gfhg怎么做?
''Create objects.
Dim objRegExp As RegExp
Dim colMatches 'As MatchCollection
Dim RetStr As String '' Create a regular expression object.
Set objRegExp = New RegExp ''Set the pattern by using the Pattern property.
objRegExp.Pattern = myPattern '' Set Case Insensitivity.
objRegExp.IgnoreCase = True ''Set global applicability.
objRegExp.Global = True ''Test whether the String can be compared.
If (objRegExp.Test(myString) = True) Then
Set colMatches = objRegExp.Execute(myString)
RetStr = colMatches(0).Value
Else
RetStr = ""
End If
mymid = RetStr
End Functionstr=mymid("asd#gfhg#jf", "#(.+?)#")
//得到的是#gfhg#,我想得到gfhg怎么做?
mymid = mid(RetStr,2,len(RetStr)-2)