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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Nighthound
Newbie


Joined: 10 May 2004
Posts: 2
Location: Singapore

PostPosted: Mon May 10, 2004 3:06 pm   

Pattern matching on second word
 
Let's say I want to do a pattern match on a string of the following format: <mob name> of <area>, and extracting the mob name and area from the string. For example, the string could be "Townguard of Solace" and I want to get two variables with "Townguard" and "Solace".

I am currently using a pattern of (*) of (*) which works most of the time, except when the area has "of" in the name, for example with the string "Monster of Tomb of Horror" in which case my pattern will match with mob name of "Monster of Tomb" and area "Horror". How do I improve my trigger such that it will correctly parse the string to be "Monster" and "Tomb of Horror"?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon May 10, 2004 4:28 pm   
 
#TR {(*) of (*)} {#IF %pos( " of ", "%1") {#VAR mobname {%word( "%1", 1, " of ")};#VAR area {%right( "%1", %pos( " of ", "%1") + 3) of %2}} {#VAR mobname {%1};#VAR area {%2}}}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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