|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Mon Jan 08, 2007 3:47 pm
[1.24] Trouble with %subregex |
I'm not sure if this is a real bug or if I'm just having trouble getting it right in my CMUD script. I've converted my %subregex call so it doesn't use %%1 any more, and it seems like it should work, but the result is always empty (which makes me think it may not be setting the variables at all).
Code: |
#VAR kills {}
#ADDKEY kills "a mountain rockeater" 5
#ADDKEY kills "a majestic moose" 25
#SHOW %subregex(%expanddb(@kills, "|"), "([^\d\|]+)=(\d+)", "(%1|%2)") |
Basically, I'm taking a data record variable and making it a list of nested pairs. The output from this function call should be "(a mountain rockeater|5)|(a majestic moose|25)"...
Anyone have any ideas as to what could make this work (if it's not a bug)? |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon Jan 08, 2007 4:42 pm |
Is that match right?
thought \d+ would be only digits, so it's not match "a mountain rockeater" for example
Actually, something is odd with the matches anyway...
#SHOW %subregex(%expanddb(@kills, "|"), "([^\d\|]+)=(\d+)", "(asd|asd)")
returns
(asd|asd)|(asd|asd)
so the pattern is okay, but as you said, it's not remembering the %1 or %2
Even odder that it matches just using a normal regex trigger
#regex {([^\d\|]+)=(\d+)} {#say %1 %2} |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Mon Jan 08, 2007 5:45 pm |
The pattern matches "not a number or pipe symbol, followed by equals sign, followed by a number." The ^ in the pattern is the key, and I know I could do it any number of other ways, but I liked this solution best. :)
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jan 17, 2007 9:05 pm |
Yes, %subregex is not handling %1..%99 correctly. It's been added to the bug list.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|