mIRC Home    About    Download    Register    News    Help

Topic Options
#163709 - 03/11/06 06:46 PM $regsubex possible bug!
b1ink Offline
Vogon poet

Registered: 16/10/06
Posts: 166
Loc: Kuwait
$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.


Edited by b1ink (03/11/06 06:47 PM)
_________________________
Kind Regards, blink

Top
#163710 - 03/11/06 08:15 PM Re: $regsubex possible bug!
starbucks_mafia Offline
Hoopy frood

Registered: 09/12/02
Posts: 2962
Loc: Norwich, UK
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] )
_________________________
Spelling mistakes, grammatical errors, and stupid comments are intentional.

Top
#163711 - 03/11/06 08:56 PM Re: $regsubex possible bug!
b1ink Offline
Vogon poet

Registered: 16/10/06
Posts: 166
Loc: Kuwait
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.
_________________________
Kind Regards, blink

Top