Gammon Forum
Entire forum
MUSHclient
General
Highlighting under certain conditions
Highlighting under certain conditions
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Glodan
(4 posts) 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 ? | top |
|
Posted by
| Nick Gammon
Australia (22,982 posts) 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 | 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 page
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.