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 ➜ Lua ➜ Highlighting an entire line containing matched regexp

Highlighting an entire line containing matched regexp

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


Posted by Boxknife   (19 posts)  Bio
Date Sun 23 Nov 2008 11:38 PM (UTC)
Message
I want to write a trigger that highlights everything between quotation marks. Right now I have a trigger set to fire on "*", but it only highlights the quotation marks themselves. I want the trigger to highlight everything in between, too.

How do I do that?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 23 Nov 2008 11:49 PM (UTC)
Message
Can you show us the trigger please:

http://mushclient.com/copying

- Nick Gammon

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

Posted by Boxknife   (19 posts)  Bio
Date Reply #2 on Mon 24 Nov 2008 12:53 AM (UTC)
Message
<triggers>
<trigger
custom_colour="2"
enabled="y"
group="Highlighted Words"
ignore_case="y"
keep_evaluating="y"
match="\&quot;*\&quot;"
regexp="y"
repeat="y"
sequence="90"
other_text_colour="silver"
>
</trigger>
</triggers>

Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 24 Nov 2008 02:45 AM (UTC)
Message
Change it to:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   group="Highlighted Words"
   ignore_case="y"
   keep_evaluating="y"
   match="\&quot;.*\&quot;"
   regexp="y"
   repeat="y"
   sequence="90"
   other_text_colour="silver"
  >
  </trigger>
</triggers>


You need a dot before the *, because .* means "any number of anything".

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 24 Nov 2008 04:36 AM (UTC)
Message
You might also want to change from:


".*"


to:


".*?"


The question mark makes the match "less greedy" which will make a difference if you have two lots of quoted things in a single line.

- Nick Gammon

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

Posted by Boxknife   (19 posts)  Bio
Date Reply #5 on Mon 24 Nov 2008 02:43 PM (UTC)
Message
This works! Thanks.
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.


21,519 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.