Replacing a range of values in metal map with single value

Replacing a range of values in metal map with single value

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
The Yak
Posts: 351
Joined: 20 May 2012, 05:36

Replacing a range of values in metal map with single value

Post by The Yak »

So this is what my current metal_map_layout looks like: http://pastebin.com/9z7DRmSB

My question: what is the best way (in Notepad++ or the like) to replace all those different metal values with a single value (2.15)? I've been trying with regular expression but I don't understand it too well and each time get stuck at "it doesn't work and I have no idea why".
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Replacing a range of values in metal map with single val

Post by CarRepairer »

This works in Komodo Edit, which may be the same in NP++:

Code: Select all

metal = [\d\.]*}

metal = 2.15}
User avatar
The Yak
Posts: 351
Joined: 20 May 2012, 05:36

Re: Replacing a range of values in metal map with single val

Post by The Yak »

Nope just invalid expression error.

I learned that alt-click in column and type the value manually works. As of now that seems like the best way for Notepad++.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Replacing a range of values in metal map with single val

Post by CarRepairer »

The Yak wrote:Nope just invalid expression error.

I learned that alt-click in column and type the value manually works. As of now that seems like the best way for Notepad++.
That is painful for me to read.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Replacing a range of values in metal map with single val

Post by zwzsg »

I used:
Replace: metal\s*\=\s*[\d\.]+
With: metal = 2.15
and it worked.
Post Reply

Return to “Lua Scripts”