|
Seyen Beginner
Joined: 31 Aug 2005 Posts: 15
|
Posted: Tue Sep 20, 2005 8:08 pm
Yet another question about #LOOPDB and %regex. |
Code: |
#LOOPDB @RoomCapCodes {#IF {%regex(@Bulk, "\e\[(?:0;|)"%val"m",RoomCapPos.%key)} {#ECHO LoopDone}} |
Now, what I wanted to do. I have a database variable RoomCapCodes that looks like
Code: |
RoomName 1;32
RoomDesc 1;30 |
etc. Those are ansi color codes.
Anyhoo. I have a variable(Bulk) that stores a string of text, containing text these codes. Now, I need to: Do a #LOOPDB and put a if with a regex for a condition. But more important for me is not that it matches, but that it also outputs the position of it's match in another database variable like
Code: |
RoomName 1
RoomDesc 16
RoomExits 120 |
. But what happens is that %regex does not perceive %val and %key. It works if I simply replace "%val" with 1;32, and store it into a variable with a given name("Blah" instead of "RoomCapPos.%key"). Is this a bug, a technical limitation, or lack of knowledge on my part? |
|
|
|
Seyen Beginner
Joined: 31 Aug 2005 Posts: 15
|
Posted: Wed Sep 21, 2005 5:42 pm |
Ok, I've reached a conclusion that variables are not expanded inside a %regex(nor %match, nor %subregex), but are expanded inside a #REGEX. I'm asking those who know, is there a workaround?
|
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Wed Sep 21, 2005 7:29 pm |
You should be able to force for variable expansion with %expand. It might help if you posted the function call that's giving you problems, so we can see if you have quotes/braces, where the variables are, etc.
|
|
|
|
Seyen Beginner
Joined: 31 Aug 2005 Posts: 15
|
Posted: Wed Sep 21, 2005 7:39 pm |
For the time beeing I settled for another method, but the fuction call is the line of code I posted above.
Code: |
#LOOPDB @RoomCapCodes {#IF {%regex(@Bulk, "\e\[(?:0;|)"%val"m",RoomCapPos.%key)} {#DOSTUFF}} |
Basically, any variables inside %regex on the second posion(ie, %regex(x,y,z), y beeing the position in question) are not expanded. Any. Not just the predefined %val and %key. |
|
|
|
|
|
|
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
|
|