I have a large XML file, and I would like to match all the content in between the <event>...</event> (usually the content spans several lines). Somehow RegExp does not want to work.
So, for testing/debugging purpose I use this function:
If I pass"<event>" as a pattern, it finds the "<event>" occurences correctly.
Similarly, if I pass "</event>" as a pattern, it finds all the "</event>" occurences correctly as well.
If I pass "<event>.*</event>" then it finds only ONE-LINERS.
If I pass "<event>[.\n]*</event>" then it does NOT find anything.
Your help is greatly appreciated.
regards,
rydel n23
So, for testing/debugging purpose I use this function:
Code:
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
If I pass"<event>" as a pattern, it finds the "<event>" occurences correctly.
Similarly, if I pass "</event>" as a pattern, it finds all the "</event>" occurences correctly as well.
If I pass "<event>.*</event>" then it finds only ONE-LINERS.
If I pass "<event>[.\n]*</event>" then it does NOT find anything.
Your help is greatly appreciated.
regards,
rydel n23