mIRC Home    About    Download    Register    News    Help

Print Thread
small bug in $regsubex #211929 05/05/09 04:09 PM
Joined: Sep 2003
Posts: 38
S
snabbi Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2003
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.

Re: small bug in $regsubex [Re: snabbi] #211933 05/05/09 05:03 PM
Joined: Jul 2006
Posts: 3,890
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,890
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

Last edited by Wims; 05/05/09 05:06 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Re: small bug in $regsubex [Re: Wims] #211934 05/05/09 05:38 PM
Joined: Sep 2003
Posts: 38
S
snabbi Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2003
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.

Re: small bug in $regsubex [Re: snabbi] #211935 05/05/09 05:53 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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"