mIRC Homepage
Posted By: b1ink $regsubex possible bug! - 03/11/06 06:46 PM
$regsubex treats third parm like plain text when it stored in a variable. see both examples below.

//var %a,%r = \1 | echo -a $or(,$regsub(abc,/(.)/g,%r,%a)) %a
* return abc black reversed.

//var %r = \1 | echo -a $regsubex(abc,/(.)/g,%r)
* return \1\1\1

I used \t for another script which already set, but I want to specify my own output manually this time.
Posted By: starbucks_mafia Re: $regsubex possible bug! - 03/11/06 08:15 PM
This is the correct behaviour. The third parameter of $regsubex() evaluates differently so that identifiers and variables can be used in the substituted text. This is necessary so that things like $regsubex(abc,/\b([a-z])/g,$upper(\1)) works as expected.

If you want to use the value of a variable as the subtext you just need to use evaluation brackets to change the order of evaluation like so:

Code:
//var %r = \1 | echo -a $regsubex(abc,/(.)/g, [color:red][[/color] %r [color:red]][/color] )
Posted By: b1ink Re: $regsubex possible bug! - 03/11/06 08:56 PM
I never thought that could be evaluated specially when the third parameter contain escaped letters or number also when I used $() against the whole identifier. thanks might.
© mIRC Discussion Forums