Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ 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 page


Posted by Kinjiru   (6 posts)  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.
Top

Posted by Nick Gammon   Australia  (23,131 posts)  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
Top

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


3,594 views.

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

Go to topic:           Search the forum


[Go to top] top

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