mIRC Homepage

small bug in $regsubex

Posted By: snabbi

small bug in $regsubex - 05/05/09 04:09 PM

mIRC version 6.35
//tokenize 32 aaaa b | echo -a test: $regsubex($1,/a/g,$2)

The $2 is not evaluated as a replace value which makes it return nothing. It will work by using a %var instead of $N (in which N is a number).

Personally I think the value of $2 should have been converted to the b value before calling the regsubex.
Posted By: Wims

Re: small bug in $regsubex - 05/05/09 05:03 PM

This isn't a bug, rather something annoying that will not change.
mIRC use $N itself in order to get the \N value that can be used in $regsubex, like $regml().

Edit : some better explanation : http://forums.mirc.com/ubbthreads.php?ub...true#Post193737
Posted By: snabbi

Re: small bug in $regsubex - 05/05/09 05:38 PM

Thanks for the explanation.

Still I think it is weird that the argument $2 is passed to the procedure call rather than the value of $2. I would have expected this when using $!2 or $ $+ 2.
In example I would have expected: $regsubex($1,/(a)/g, [ $2 ] )

Nice examples in your post as well btw.
Posted By: argv0

Re: small bug in $regsubex - 05/05/09 05:53 PM

identifiers are delay-eval'd in $regsubex so that things like $nick(\1, \2) work properly, so the [ $2 ] behaviour cannot be implicit. But, as you just pointed out, using [ $2 ] is a fine way to properly pass the $2 you expect.
© 2022 mIRC Discussion Forums