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 ➜ Highlightning

Highlightning

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


Posted by Tsinghahla   Sweden  (14 posts)  Bio
Date Fri 01 Aug 2008 06:46 PM (UTC)

Amended on Fri 01 Aug 2008 07:54 PM (UTC) by Tsinghahla

Message
Hello,

I'm trying to make two highlights in 'one'.

This is the text from the MUD:
Your ouroboros senses Varek, Initiate of the Sanguine at Starlit Ritual Room, on a health of 324 and a mana of 285.


So I made a trigger that looks like this:
<triggers>
<trigger
custom_colour="7"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="\bYour ouroboros senses .+? at\b"
regexp="y"
sequence="90"
>
</trigger>
</triggers>


What I'd like to do is that get the name, inbetween 'Your ouroboros senses' and 'at' highlighted aswell, but in a different colour. It took med about 30 minutes just to get that simple trigger working, so...not all to handy with this. Is this possible to do?
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 02 Aug 2008 03:42 AM (UTC)
Message
Try this:


<triggers>
  <trigger
   custom_colour="7"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="\bYour ouroboros senses\b"
   regexp="y"
   sequence="90"
  >
  </trigger>

  <trigger
   custom_colour="3"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(?&lt;=\bYour ouroboros senses\b).+?(?=\bat\b)"
   regexp="y"
   sequence="90"
  >
  </trigger>
</triggers>


The first trigger is sort-of what you had. The second one uses a "lookbehind assertion" to check that we have "Your ouroboros senses" *however* an assertion does not becomes part of the matched text, and is thus not coloured. The word "at" is then part of a "lookahead assertion" which anchors the colouring to finish at the word "at".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Tsinghahla   Sweden  (14 posts)  Bio
Date Reply #2 on Sat 02 Aug 2008 10:03 AM (UTC)
Message
Thanks a lot, works perfectly and that piece of regexp makes me understand a bit more about it. Wonderful!
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.


10,541 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.