Highlighting under certain conditions

Posted by Glodan on Tue 11 Mar 2014 03:13 AM — 2 posts, 10,582 views.

#0
I'm trying to do highlight a set of words I have stored in a variable, but only highlight those words when they are situated close to specific other words/characters such as:

pets = cat|dog|fish

Example source:
Quote:

Pet: cat
catnip
[ooc] example says, "Just gave my cat some tunafish, he loves it!"

My desired match/result:
Quote:

Pet: cat
catnip
[ooc] example says, "Just gave my cat some tunafish, he loves it!"

What I've been getting:
Quote:

Pet: cat
catnip
[ooc] example says, "Just gave my cat some tunafish, he loves it!"



I've been experimenting with different 'match' criteria such as:

\b@!pets\b

^Pet: @!pets\s*


I used the inbuilt hightlight text trigger generation and set it to variables and unticked ignore case.

<triggers>
  <trigger
   custom_colour="11"
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   make_underline="y"
   match="\b@!pets\b"
   regexp="y"
   repeat="y"
   sequence="90"
  >
  </trigger>
</triggers>



But I'm just not having any luck, could anyone tell me where abouts I'm going wrong ?
Amended on Tue 11 Mar 2014 03:14 AM by Glodan
Australia Forum Administrator #1
Since you are matching alternatives put them in brackets. Try this:


<triggers>
  <trigger
   custom_colour="11"
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   make_underline="y"
   match="\b(@!pets)\b"
   regexp="y"
   repeat="y"
   sequence="90"
  >
  </trigger>
</triggers>