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 ➜ Regexp of strings

Regexp of strings

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


Posted by Urte   (3 posts)  Bio
Date Fri 19 Jul 2002 11:40 AM (UTC)

Amended on Fri 19 Jul 2002 11:41 AM (UTC) by Urte

Message
All right. I need to ask a question, I /have/ to be merely missing something simple in regexps or such.

How do I highlight a string so that string (and only that string) appears highlighted in the paragraph?

IE: Say I wish to highlight the name 'James' so it do the following highlights:

James
(James,
James)

Etc. Basically highlight the string no matter where it appears on the line, but only that substring, in case the bold stuff there isn't easily seen.

And I get the feeling I'm missing something simple. ;)

Urte
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #1 on Fri 19 Jul 2002 07:14 PM (UTC)
Message
One of my early triggers, this works on the word "manhole":

<triggers>
  <trigger
   custom_colour="8"
   enabled="y"
   match="(manhole)"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Urte   (3 posts)  Bio
Date Reply #2 on Fri 19 Jul 2002 10:53 PM (UTC)
Message
Ah. Much better. That works well. My mind's gone off regexps since starting to use Windows programs instead of Tinyfugue, seem to have forgotten almost everything. Thanks!

Urte
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 01 Aug 2002 12:48 AM (UTC)
Message
In fact, you can do without the brackets, which merely return the contents as wildcard 1, which you aren't using.

In your case, just match on "James" and make it a regexp.

eg.


<triggers>
  <trigger
   custom_colour="3"
   enabled="y"
   match="James"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


15,153 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.