Page 1 of 1

literal 0 in replace string after group substitution

Posted: Mon Dec 02, 2019 12:32 am
by 4EverMaAT
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?

Re: literal 0 in replace string after group substitution

Posted: Tue Dec 03, 2019 11:16 am
by DigitalVolcano
Try-

Code: Select all

${1}0
Putting the curly brackets round the number separates it from the following literals.

Re: literal 0 in replace string after group substitution

Posted: Tue Dec 03, 2019 3:46 pm
by 4EverMaAT
DigitalVolcano wrote: Tue Dec 03, 2019 11:16 am 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.