A trigger question

Posted by Helio on Wed 23 Oct 2002 02:20 PM — 3 posts, 15,408 views.

#0
Hi,
I having this problem with some triggers..
Oky, so far this is my trigger,
(John|Jack|Tom|Harry)
I trigger these names so that they change to the colour red when it appears on the output.
Ie: Tom the Hairball ( Tom would be in red )
However, it seems that the client colours anything with the words in the trigger present, for instance Jackal, since it contains Jack thus the Jack is coloured red and -al in Jackal is left unchanged. How can i do it such that the trigger only colours Jack and not Jack-al.
#1
How about:

"(John|Jack|Tom|Harry)(?: |$)"

Without the quotes.

I tried minimal testing on it and it seems to work.

Basically it checks for a space or end of line after the name to make sure there's no more letters.
Amended on Wed 23 Oct 2002 10:55 PM by Vaejor
Australia Forum Administrator #2
Try this:

\b(John|Jack|Tom|Harry)\b

The \b says "assert this is a word boundary".

Read the file RegularExpressions.txt that comes with MUSHclient for more details about the fancy things you can do with regular expressions.

This will catch other things (eg. name followed by period, comma etc.)