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


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Thu Jan 27, 2005 10:53 pm   

Pattern Matching use of %y and %q
 
I see %y and %q used in a lot of the triggers in the forum posts, but I'm confused as to when you would use %y or %q versus %x or %p respectively.

Could someone explain the difference, and give a quick example?
_________________
Erasmus
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jan 28, 2005 5:16 am   
 
I think they equate to (the anchor characters + %x)? Thus, instead of doing something like this:

^(%x) entered the building.

you could just do:

(%y) entered the building.

to ensure a pattern didn't match any midline occurrances.

%y would be for instances when any non-whitespace symbol anchored the line, while %q would be only for punctuation.
_________________
EDIT: I didn't like my old signature
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jan 28, 2005 10:47 am   
 
Also %y and %q qualify as both beginning and end of line anchors. That is why patterns of "%q{@List}%q" are so useful. This completely delimit the text portion of the list, forcing it to be a single distinct word anywhere in the line. %y is not used as much, in fact I can't really think of any use for it other then as a shortcut such as MattLofton described.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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