Martini002
Martini002

Reputation: 123

Notepad++ Replace all lines starting with

Here is the original line:

Ore(DIAMOND_ORE,7,1,100.0,0,16,STONE)

I have 320 files containing that but with other params, I just want to search for:

Ore(DIAMOND_ORE

And replace the whole line by:

Ore(DIAMOND_ORE,1,1,1,0,5,STONE)

How can I do that?

Thanks

Upvotes: 4

Views: 35908

Answers (2)

Stamerlan
Stamerlan

Reputation: 1

Set search mode "Regular expression"
Find what: ^Ore\(DIAMOND_ORE.*
Replace with: Ore\(DIAMOND_ORE,1,1,1,0,5,STONE\)

Upvotes: 0

Jherico
Jherico

Reputation: 29240

The search regex you want is ^Ore\(DIAMOND_ORE.*

The ^ character means match the beginning of a line and the .* means match any character any number of times.

For a single file you can use the simple search and replace feature.

Make sure the find and replace box has Regular Expressions checked and that . matches newline is not checked.

Then set your replacement text to

Ore\(DIAMOND_ORE,1,1,1,0,5,STONE\)

Your search and replace box should look like this:

enter image description here

Hit Replace All. Done.

I have 320 files containing that but with other params

If you have multiple files to process, just click on the Find in Files tab and set your filter and directory, and then hit Replace in Files. I recommend you back-up your target files first though.

Upvotes: 16

Related Questions