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
masterkrueger
Wanderer


Joined: 24 Jan 2010
Posts: 65
Location: Hamburg

PostPosted: Sun Jun 20, 2010 4:29 pm   

Pattern matching again ;)
 
Is it possible to match or find the position of any of the punctuation marks?
I need the first occurrence of there three here: .!?

Code:
#PRINT %match(@RName, @PunctuationMarks)
#PRINT %pos(@PunctuationMarks, @RName)


PunctuationMarks is a Stringlist with .!?
and RName is a sentence from the mud with . in it
but it shows 0 (not found) everytime.

I know i could make an workaround to test for each sign but thats not stylish ;)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Jun 20, 2010 6:26 pm   
 
Edit: Turns out I went for a more complex answer than was needed.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Sun Jun 20, 2010 7:48 pm   
 
Try:
#PRINT %match(@RName, "[.!?]")
Reply with quote
masterkrueger
Wanderer


Joined: 24 Jan 2010
Posts: 65
Location: Hamburg

PostPosted: Mon Jun 21, 2010 6:18 pm   
 
Thanks that works, i tried [.!?] without the "
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