I need to find all the occurrences of a particular RegEx in my source code (i.e. col*r ). I realized you can programmatically search through your code for patterns (RegEx) if you use the VBComponents.CodeModule.Find() method as it's explained in here and here. But that does not meet my needs as it only tells you whether such expression is found or not. I need the actual expression found in the module as well (e.g. colour and color).
Is there any way to achieve this programmatically within VBA?
Dim re, match
Set re = CreateObject("vbscript.regexp")
re.Pattern = "your regex"
re.Global = True
For Each match In re.Execute("you input")
MsgBox match.Value
Next
for more information check this link:http://msdn.microsoft.com/en-us/library/ms974570.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With