|
换行符的表示有多种。。。举个小例子好了
Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches ' Create variable.
Set regEx = New RegExp ' Create regular expression.
regEx.Pattern = patrn ' Set pattern.
regEx.IgnoreCase = True ' Set case insensitivity.
regEx.Global = True ' Set global applicability.
Set Matches = regEx.Execute(strng) ' Execute search.
For Each Match in Matches ' Iterate Matches collection.
RetStr = RetStr & "Match " & I & " found at position "
RetStr = RetStr & Match.FirstIndex & ". Match Value is "'
RetStr = RetStr & Match.Value & "'." & VbCrLf
Next
RegExpTest = RetStr
End Function
s = "1"&vbNewLine&"2"&VbCrLf&"3"&vbCr&"4"&vbLf&"5"
MsgBox(RegExpTest(vbLf&"+", s)) |
|