 |
Erasmus Wanderer
Joined: 04 Aug 2004 Posts: 82 Location: Philadelphia
|
Posted: 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 |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
 |
|
|