I'm trying to comment out all of the variable type declarations in a script I have, but I've run into this problem a few other times. I'd like to match a string, followed by a variable name, followed by a string and replace the exact text but with a single quote in front of the second string.
Dim variableName As Boolean Dim variableName2 As String
Dim variableName 'As Boolean Dim variableName2 'As String
Now, a problem is the I also have "As" strings elsewhere in the code that shouldn't be replaced, so a simple find/replace wont work.
I'm using NotePad++ and have the following regex that matches my declarations correctly:
But I can't figure out what to put in place of the
.* in the replace field.
Dim.*'As obviously replaces the wildcard string with a literal
.*, which is no good.