 |
Jeo Newbie
Joined: 14 Jun 2004 Posts: 3
|
Posted: Mon Jun 14, 2004 9:13 pm
Matching whole word in trigger. |
I want to make color triggers for specific players' names. One of these names is Ral. The problem with this, is that Ral is a common string in larger words (neutral, emerald, etc.). Is there a way to match the pattern only if it is a whole word, or if it is followed by a word delimiter? Possible examples that I can think of are:
Ral
Ral(
Ral,
These could fall either at the beginning of the line, or somewhere in the middle. Also, capitalization could vary, such as RAl, rAl, or RaL. |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Jun 14, 2004 9:39 pm |
Use %p or %q to mark the beginning and end of your word.
%p match any punctuation
%q match any punctuation (same as %p but matches start and end of line) |
|
|
 |
Jeo Newbie
Joined: 14 Jun 2004 Posts: 3
|
Posted: Mon Jun 14, 2004 9:53 pm |
If I make my trigger pattern %qRal, it fires on 123abcRal no matter if it's at the beggining of the line or not. I want it to only fire if Ral is at the beginning of the line followed by a space or delimiter, or anywhere else in the line as long as it is followed and preceded by a space or delimiter.
ex: Ralph said hello to Ral. --> no part of Ralph should be colored, but Ral at the end should be. |
|
|
 |
Theragil Apprentice

Joined: 13 Feb 2004 Posts: 157 Location: USA
|
Posted: Mon Jun 14, 2004 10:01 pm |
Make the trigger case sensitive and follow it with %q (in this case, Ral%q). I use this all the time.
|
|
|
 |
Jeo Newbie
Joined: 14 Jun 2004 Posts: 3
|
Posted: Mon Jun 14, 2004 10:12 pm |
The trigger cannot be case sensitive due to the possibilty of random caps (Ral, rAl, RAL, etc.) I found that I can do:
^%pRal%p to catch Ral at the beginning of a line, and
%pRal%p to catch Ral anywhere else.
Can I combine these somehow into one trigger? I tried {^%pRal%p|%pRal%p} but that doesn't work. Any suggestions? Or am I just stuck making 2 triggers? |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4772 Location: Pensacola, FL, USA
|
Posted: Tue Jun 15, 2004 4:58 am |
i think it is possible if you write a Perl regular expression trigger... but im not familiar enuff with the syntax to be sure.
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Jun 15, 2004 3:17 pm |
Although the test tab may show 123abcRal, I don't think that 123abc will match %q. If any of those 6 characters match %q, it's a bug and you should submit a bug report.
|
|
|
 |
|
|