mIRC Home    About    Download    Register    News    Help

Print Thread
$regsubex with $N #193732 24/01/08 07:26 PM
Joined: Jul 2006
Posts: 3,930
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,930
Code:
//tokenize 32 1 2 | echo -a > $regsubex(a,/a/,$1 $2)
//tokenize 32 1 2 | echo -a > $regsubex(a,/a/,Ga $1)
I think this is a bug, in the third parameter of $regsubex, $N return $null...

Edit : another strange thing :
Code:
echo -a > $regsubex(waf,/(a)/,$(\1,0))


Using $regsub works nice

Last edited by Wims; 24/01/08 08:21 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Re: $regsubex with $N [Re: Wims] #193737 24/01/08 09:17 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
That's an unfortunate side-effect of the fact that mirc uses $1, $2 etc internally to fill the values of \1, \2, \t, \a etc in <sub>. To get an idea, try this:
//echo -ag $regsubex(a,/(a)/,< $1 : $2 :: \1 \n >)

The $+ stuff you saw in your second example are due to the fact that when mirc encounters something like "a\1b", it turns it to "a $+ $1 $+ b", so that $1 doesn't touch other things. In this case, b is the comma right after \1 (if you leave a space, you'll see $+ is omitted).

This doesn't happen in $regsub because of the completely different way <sub> is evaluted there.


Last edited by qwerty; 24/01/08 09:20 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: $regsubex with $N [Re: qwerty] #193740 24/01/08 09:44 PM
Joined: Jul 2006
Posts: 3,930
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,930
Thank you for this explanation smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel