Regex is driving me up the wall
-
I’m having issues with regex.
I have a series of lines in this form:IIf(ISNULL([text1])<>'' And Left(ISNULL([text2]),4)="Appr",[text3]
I want to insert text in between the’]'and the ‘)’ like this:
IIf(ISNULL([text1],'')<>'' And Left(ISNULL([text2],''),4)="Appr",[text3]
I’ve tried this regular expression
Find what: (ISNULL.*\])(*.*) Replace with: \1,''\2
apparently tagging doesnt appear to work the way I thought it did.
Any help would be greatly appreciated -
One problem is that your use of
.*
is grabbing too much. You’ll want to change that to.*?
which will match the minimum amount. And then the*.*
looks too much like CMD shell wildcard/globbing…I’m away from Notepad++ at the moment so I can’t actually try it out, but maybe something like this will work, or at least give you a boost:
Find-what zone:
ISNULL.*?\]
Replace-with zone:$0,''
In words: match ISNULL through the immediately following closing bracket, replace the match with what was found (represented by
$0
) plus a comma and two single-quotes.