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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Highlighting two separate expressions on one line

Highlighting two separate expressions on one line

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


Posted by Kinjiru   (6 posts)  [Biography] bio
Date Tue 11 Jul 2023 05:27 AM (UTC)

Amended on Tue 11 Jul 2023 05:28 AM (UTC) by Kinjiru

Message
So, say you have something like this:

Telepathy[Bob] Hello!

You want the Telepathy[Bob] part to be a certain color.

You want everything after Telepathy[Bob] to be a different color.

And, Bob isn't the only player so you're matching any player there.

I accomplished the first part with ^(Telepathy\[.*\]) but I am unsure how I can highlight the rest of the message (which can be any text) a different color.
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 11 Jul 2023 06:50 AM (UTC)
Message
Make two triggers, like this:


<triggers>
  <trigger
   custom_colour="3"
   enabled="y"
   keep_evaluating="y"
   match="^(Telepathy[.*]).*$"
   regexp="y"
   sequence="50"
  >
  </trigger>
  <trigger
   custom_colour="2"
   enabled="y"
   match="^(Telepathy[.*])"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>


The first trigger (with the lower sequence number, and "keep evaluating" checked) colours the whole line.

The second trigger colours the Telepathy[someone] part, so that change the colours back.

Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

- Nick Gammon

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

Posted by Kinjiru   (6 posts)  [Biography] bio
Date Reply #2 on Tue 11 Jul 2023 01:26 PM (UTC)
Message
Worked like a charm! Thanks so much, Nick.
[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.


2,483 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]