Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
sav
Wanderer


Joined: 09 Jan 2006
Posts: 86

PostPosted: Sun Aug 23, 2009 10:16 am   

Some regex help please.
 
Hi, i'm trying to make a regex trigger to capture the prompt of the monster when i'm fighting and when i'm not and differs when i'm fighting different monsters.

[:]
[E:monname:monhealthword]
[E:monname:monhealthnumber%]
[E:monname monname2:monhealthword]
[E:monname monname2:monhealthnumber%]
[E:monname monname2 :monhealthword]
[E:monname monname2 :monhealthnumber%]

basically, i want to capture monname or monname monname2(with and without the space after monname2) into 1 variable, and monhealthword or monhealthnumber% into another variable.

thanks!
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Aug 24, 2009 7:56 pm   
 
Here's my quick try:
Quote:

[(?:E\:)?(.*):(.*)]

Then just do %trim(%1) to get rid of extra whitespace after monname2, if any. The monster names will be in %1, the health value in %2. If you are not fighting (I presume that is the situation with "[:]"), %1 and %2 will be blank.
Reply with quote
sav
Wanderer


Joined: 09 Jan 2006
Posts: 86

PostPosted: Mon Aug 24, 2009 10:06 pm   
 
nope, that doesn't work. =(
and yeah, when i'm not fighting, its [:].
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Aug 25, 2009 3:54 pm   
 
Hm, my backslashes seem to have been dropped somehow. Oh, I used quote, instead of code. Try this:
Code:

\[(?:E\:)?(.*):(.*)\]
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net