Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

@replace works case sensitive

Aug
258
4
Yesterday I became almost desperate because @replacing strings did not work (as expected).
I was really doubtful about my mind - until I RTFM.
Of course @replace works case sensitive, but what I want to ask:
Is there a way to bypass this or
perhaps the possibility to enhance @replace with a "case insensitive - switch"?
 
Perhaps a function linke this ?

ireplace=%@replace[%1,%2,%@upper[%3]]

Test:

echo %@ireplace[ABC,abc,"Test AbC"]

Result: Test abc

echo %@ireplace[ABC,abc,"Test abC"]
Result: Test abc
Is that your goal ?
 
Perhaps a function like this ?
ireplace=%@replace[%1,%2,%@upper[%3]]
Test:
echo %@ireplace[ABC,abc,"Test AbC"]
Result: Test abc
echo %@ireplace[ABC,abc,"Test abC"]
Result: Test abc
Is that your goal ?
 
Hello Stein,

that's a cool idea and actually what I want. It would also work with tcc/le without functions if I "upper" the 3rd parameter before the @replace. Thank you.

But even more elegant would be an "ignore case" switch. ;)
 
Vince Fatica's 4utils.dll / 4utiilsx64/dll plugin contains the function @XREPLACE which handles regular expression, including [aA] type pairs of upper- and lower case letters.
 

Similar threads

Back
Top