Page 1 of 1

Replace a value between 2 fixed text

Posted: 22 Aug 2021 18:20
by FreakyBird
Hello all,

I'm trying to replace a value wich is in a Filename.cfg wirch look like this :

Code: Select all

<config>
        <bool name="audio.bgmusic" value="false" />
	<bool name="global.achievements" value="true" />
	<string name="SystemsAuto" value="" />
	<string name="FolderViewMode" value="always" />
	<string name="Hiddenfeatures" value="freaky bird;super;beautiful;great;always joyfull" />
	<string name="Console Retro.ShowFlags" value="auto" />
	<string name="GamelistViewStyle" value="HCoinSpin" />
</config>
My goal is to replace the value wich is between quot one the line : <string name="Hiddenfeatures" value="freaky bird;super;beautiful;great;always joyfull" /> replaced by <string name="Hiddenfeatures" value="freaky bird;super;always joyfull" /> or any other value. This value change everytime.

I have tried with Jrepl :

Code: Select all

setlocal enableDelayedExpansion
set "newValue=myNewValue"
type "settings.cfg"|jrepl "(<string name="Hiddenfeatures" value=").*(" />)" "$1!newValue!$2" >fileName.cgf.new
REM move /y "fileName.cgf.new" "fileName.xml"
But it doesn't work since it do nothing on the file : no replacement. When i tried on small text without " " it works. So i think the quote are the problem but i don't know how to solve it and my english is poor :(

Thanks in advance if you can help !

Re: Replace a value between 2 fixed text

Posted: 23 Aug 2021 10:32
by aGerman