mIRC Home    About    Download    Register    News    Help

Print Thread
#163709 03/11/06 06:46 PM
Joined: Oct 2006
Posts: 166
B
b1ink Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
$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.

Last edited by b1ink; 03/11/06 06:47 PM.

Kind Regards, blink
#163710 03/11/06 08:15 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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.
#163711 03/11/06 08:56 PM
Joined: Oct 2006
Posts: 166
B
b1ink Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
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

Link Copied to Clipboard