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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  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] Refresh page


Posted by Boxknife   (19 posts)  [Biography] 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?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] top

Posted by Boxknife   (19 posts)  [Biography] 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>

[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] top

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


14,400 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]