Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ Find and Replace numbers regex

Trying to find and replace with a field name plus wild card values with a hard coded value.

 location = 123
 location = 456
 location = 789

I need to replace all the above with hard coded:

location = 999

I had started with this regex but not getting any matches

/location \= |\d*/
like image 283
user2158259 Avatar asked Apr 01 '26 05:04

user2158259


2 Answers

Why are you using alternation operator there? There isn't any need for it. Also you need not escape = as it isn't a meta character in regex.

Find: location\s*=\s*\d+
Replace: location = 999
like image 126
Amit Joki Avatar answered Apr 02 '26 21:04

Amit Joki


Try the following expression

location = [0-9]{3}
like image 40
java_olli Avatar answered Apr 02 '26 21:04

java_olli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!