Skip to content
⌘ NSIS Forum Archive

possible WordReplace/WordAdd bug

6 posts

hemancuso#edited

possible WordReplace/WordAdd bug

It seems there is a bug in WordReplace/WordAdd which does not allow a replacement/deletion of a word to happen when the matching pattern is at the beginning of the string.

for instance:

with $0 being "testing123"

${un.WordReplace} $0 "test" "" "+" $0

after this call, $0 remains testing123

however,

${un.WordReplace} $0 "ing1" "" "+" $0

$0 becomes "test23"

I have the same problem when I try to remove a string using wordadd. It is entirely possible I'm calling these functions incorrectly, but I have spent a while trying to get them to work and am unable to.
Instructor#
You are right. Interesting that "test" in next examples deletes. I'll fix it, thanks.

${WordReplace} "testing123" "test" "" "+1" $0
#or
${WordReplace} "testing123" "test" " " "+" $0
P.S.
Can you reproduce bug of WordAdd
hemancuso#
when $0 is "testing123"

${WordAdd} $0 "" "-test" $0

$0 remains "testing123"

${WordAdd} $0 "" "-ing" $0

$0 becomes "test123"
Instructor#
WordAdd can't take empty delimiter. Is your example correct?

${WordAdd} "testing123" "" "E-ing" $0
$0 == "1" (delimiter is empty)
hemancuso#
I was attempting to remove the first item from a comma deliminated list

when $0 is "test,something,other,no"

${WordAdd} $0 "," "-test" $0

fails, at least for me.
Instructor#
I have tested it and all ok. (output: "something,other,no")
fails, at least for me.
How fails?