|
patryn Apprentice
Joined: 26 Sep 2001 Posts: 124
|
Posted: Fri Jul 15, 2005 12:27 am
%subregex faulty? |
I have been playing around with %subregex and I have noticed a peculiarity, which i shall explain below. Im wondering if anyone knows of a way to get around this peculiarity.
The following is a %subregex example from the help file:
#show %subregex( "100 gold, 200 silver", "(\d+)", "%eval(%1+10)")
This outputs: 110 gold, 210 silver
Which is great. The problem comes in when that line is put into a trigger, or an alias. The '%1' is no longer referencing the value matched by the regular expression in the %subregex, it is instead pointing to the patterns matched by the triggers or the parameters parsed to an alias.
For example:
#alias {test} {#ECHO %subregex( "100 gold, 200 silver", "(\d+)", "%eval(%1+10)")}
Now if you type 'test blah blah', you end up with the following output:
blah10 gold, blah10 silver blah
Similar peculiarities occur when using %subregex within triggers.
So, does anyone know if there is a way i can get around this issue?
Im thinking the solution may be similar to changing %i to %j in nested loops.
---
Using Zmud 7.13a |
|
_________________ That which does not kill us, makes us stronger. |
|
|
|
patryn Apprentice
Joined: 26 Sep 2001 Posts: 124
|
Posted: Fri Jul 15, 2005 12:57 am |
(Sighs)
Seems like everytime I post something I find the answer just after.
The fix was as follows:
#alias {test} {#ECHO %subregex( "100 gold, 200 silver", "(\d+)", "%eval(%%1+10)")} |
|
_________________ That which does not kill us, makes us stronger. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Jul 15, 2005 1:18 am |
Be thankful for that, Pat. There will come a time when you really want to do something and nobody will know the answer to it (or only zugg will know).
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Fri Jul 15, 2005 10:42 am |
And recently Zugg's been forgetting things, like #AFK for example. and a few others as well i've noticed :-)
So can't hope he's the last hope.
Not knocking ya Zugg, just pointing out a funny thing in refrence to Matt's comment.
NOOOO, PLEASE DON'T NUKE MEEEEE.....AAAAAARRRRGGHHHH!!!!!
Sorry, ain't had my 10th cup of coffee yet.
Ya got somuch going on, and there's so much in zmud, and the other apps, there's no way to remember everything. |
|
|
|
|
|