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
biotsrama
Newbie


Joined: 11 Jul 2004
Posts: 4
Location: USA

PostPosted: Mon Jul 26, 2004 1:55 am   

Pattern matching: Matching everything except a given string
 
I would like to be able to match everything except a given string. For example, if I did not want to match "hello", the pattern would match "goodbye", "book", and "jump"--that is, everything except "hello".

According to the ZMUD documentation, this is accomplished using {^string}, where string is the text to exclude. Only problem is, this doesn't seem to work when I follow it up with a pattern that matches a list of possible things using the {..|...|..} syntax. For example, "{^one} two" matches "apple two" correctly and does not match "one two" correctly. However, "{^one} {two|three}" does NOT match "apple two" or "banana three", as one would expect.

I have no unusual options enabled, such as interpreting the trigger pattern as a Perl RE.

Any thoughts? Thanks for any input!
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Jul 26, 2004 2:25 am   
 
This is a bug in zMud. For the time being you will have to get around it by converting to a regex and then modifying it to be correct.

Your pattern of "{^one} {two|three}" would be correctly converted as "(?:(?!one)(?<!one)) (?:two|three)"
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
biotsrama
Newbie


Joined: 11 Jul 2004
Posts: 4
Location: USA

PostPosted: Mon Jul 26, 2004 2:39 am   
 
OK, thanks a lot. I thought something might be amiss... thanks for clearing up my headache!
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