简体   繁体   中英

Notepad++ Replace, RegEx

I'm trying to RegEx replace in Notepad++ and having issues.

Essentially I'm coding a script and have added an extra variable to a function which appears hundreds of time in my code.

So it was:
MouseClick(442,421)

Now I added a third variable for mouseclick delay so it will be

MouseClick(442,421,4500)

4.5 Sec is default delay

At the moment it won't work as a third variable isnt declared so I essentially want to use RegEx to find all my mouseclicks and add the default value of 4500 to the end, is it possible or is RegEx not the answer?

I'm trying to find: MouseClick(*,*)
And replace with: MouseClick(*,*,4500)

Also will the values be the same when replacing with a wildcard?

Thanks.

You can't replace with a wild card. You have to "capture" the values that were there before. You probably want to find

MouseClick\((.*),(.*)\)

and replace it with

MouseClick(\1,\2,4500)

Comment if you have any questions.

With the Regular Expression search mode selected, replace MouseClick\\((.*),(.*)\\) with MouseClick(\\1,\\2,4500) :

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM