literal 0 in replace string after group substitution

Tool for Search and Replace across multiple files.
Post Reply
4EverMaAT
Posts: 6
Joined: Tue Sep 24, 2019 4:07 pm

literal 0 in replace string after group substitution

Post by 4EverMaAT » Mon Dec 02, 2019 1:32 am

find

Code: Select all

^(RepeatableText=)(.*)$
replace

Code: Select all

$1

Code: Select all

0
but it is written as $10

and the replace text is written as $10 instead of $1 being the first group, followed by a literal 0


Any ideas?
User avatar
DigitalVolcano
Site Admin
Posts: 1201
Joined: Thu Jun 09, 2011 10:04 am

Re: literal 0 in replace string after group substitution

Post by DigitalVolcano » Tue Dec 03, 2019 12:16 pm

Try-

Code: Select all

${1}0
Putting the curly brackets round the number separates it from the following literals.
4EverMaAT
Posts: 6
Joined: Tue Sep 24, 2019 4:07 pm

Re: literal 0 in replace string after group substitution

Post by 4EverMaAT » Tue Dec 03, 2019 4:46 pm

DigitalVolcano wrote:
Tue Dec 03, 2019 12:16 pm
Try-

Code: Select all

${1}0
Putting the curly brackets round the number separates it from the following literals.
I will remember that next time. I ended up doing

Code: Select all

$1 0 
(a space between the $1 group and literal 0)

And then added a separate non-regex search into the batch for

Code: Select all

RepeatableText= 0
(now a space between = and 0 from previous search/replace operation)

and replace with

Code: Select all

RepeatableText=0
(Removing the literal space after =)

That is what I liked about your software. I didn't have to drive myself crazy for 10 hours trying to make it perfectly efficient search. I just did it the crude way and it still worked out ok. But now I know also the more efficient way.
Post Reply