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
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Mon Feb 24, 2014 11:42 am   

Pattern matching.
 
I've come into a problem, I have the following pattern that I want to get variables from:

&Name the &Race (*)

It will fire on for example:

Scarn the edain Bear-Spirit

However it also fires on any sentence with "the" as the second word. In an ideal situation I
would something like

&Name the {edain|elven|dwarven}(*)

This would allow it to only fire on the text I need it to, but if I am using "match pattern", how
do I save it to the Race variable?
Reply with quote
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Mon Feb 24, 2014 4:24 pm   
 
Apparently I have been getting patterns wrong all this time, I've sorted it using the following method:

Code:
^%w the ({edain|elven|dwarven})(*)


I then use the following to capture the variables and achieve the aim!

Code:
name = %1
race = %3
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