[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Highlighting under certain conditions

Highlighting under certain conditions

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Glodan   (4 posts)  [Biography] bio
Date Tue 11 Mar 2014 03:13 AM (UTC)

Amended on Tue 11 Mar 2014 03:14 AM (UTC) by Glodan

Message
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 ?
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 11 Mar 2014 11:20 AM (UTC)
Message
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>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


7,292 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]