user2158259
user2158259

Reputation: 137

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*/

Upvotes: 2

Views: 10691

Answers (2)

java_olli
java_olli

Reputation: 51

Try the following expression

location = [0-9]{3}

Upvotes: 4

Amit Joki
Amit Joki

Reputation: 59232

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

Upvotes: 5

Related Questions