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,''\2apparently 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login