@replace weirdness

Oct 29, 2008
I’m trying to make an esc function for echoing stuff containing special chars without having to use quotes.

Why does
echo %@replace[^|,^^|,%@replace[^^,^^^^,foo|bar]]
evaluate to

It seems to be doing the ^ replacement after doing the | replacement.
echo %@replace[^|,^^|,foo|bar]
evaluates to
as expected. My full esc function works as expected if the ^ replacement is omitted.
27.6G C:\Users\johnb\tmp> eset /f esc

27.6G C:\Users\johnb\tmp> echo %@esc[&|<>]
(n.b. To enter this function at the command line, double all ^s)
function esc=`%@replace[^^>,^^^^>,%@replace[^^<,^^^^<,%@replace[^^&,^^^^&,%@replace[^^|,^^^^|,%$]]]]`
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly Documentation Replace internal command with LIBRARY command Support 0
I how to make TCC default/replace cmd.exe? Support 9
x13 TPIPE /REPLACE - Remove line (including EOL) Support 3
T @replace -- what is wrong here Support 2
C Replace 1st argument on command line Support 4
R How to? Replace in Rename Support 9
C How to? @replace[a comma,_,filename] Support 5
MickeyF Can't get my TPIPE /replace to work Support 4
C @replace and @xreplace problems Support 5
C How to? Replace &'s in filenames / FixNames.dll Support 2
M I'm unable to use @replace[] with a % character in string2 Support 12
MikeBaas Strange prob with %@replace.. Support 4
vefatica Back-refs in TPIPE's /replace's replacement string? Support 2
Frank @replace works case sensitive Support 5
vefatica TPIPE /replace? Support 3
Stefano Piccardi replace tcc process space? Support 8
vefatica @SUBST ... how replace character with a caret? Support 9
mdwyer @replace - global use in a text file Support 3
B Regex and Replace Support 6
B REPLACE is good news Support 0
J Problem with %var:find=replace% syntax Support 5
T Wine weirdness Support 1
T 17.00.66 Weirdness Support 3
vefatica Fixed IDE weirdness Support 3
Steve Pitts @PID weirdness Support 2
R Download weirdness Support 1
Y More v13 weirdness Support 4
M Another bit of weirdness.... Support 0

Similar threads