mIRC Home    About    Download    Register    News    Help

Topic Options
#211929 - 05/05/09 05:09 PM small bug in $regsubex
snabbi Offline
Ameglian cow

Registered: 03/09/03
Posts: 38
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.

Top
#211933 - 05/05/09 06:03 PM Re: small bug in $regsubex [Re: snabbi]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3503
Loc: France
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


Edited by Wims (05/05/09 06:06 PM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#211934 - 05/05/09 06:38 PM Re: small bug in $regsubex [Re: Wims]
snabbi Offline
Ameglian cow

Registered: 03/09/03
Posts: 38
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.

Top
#211935 - 05/05/09 06:53 PM Re: small bug in $regsubex [Re: snabbi]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
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.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top