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 ➜ Regular Expressions -- Confundling

Regular Expressions -- Confundling

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


Posted by Bobo_the_bee   USA  (6 posts)  Bio
Date Wed 04 Apr 2007 05:47 PM (UTC)
Message
I'm very confused on Regular Expressions, well, the making part of them, that is. I was trying to edit the Health Bar plugin to work with my prompt, which is:

][ Gershaw <4714/4714hp> -- then a bunch of random stuff like money, xp till next level, blah blah blah that I figured could get grouped into one unused variable.

I just can't even begin wondering how I create the regular expression for this. Help on this, or a pointer to a helpfile on making regular expressions, would be very much appreciated.

The lions sing and the hills take flight.
The moon by day, and sun by night.
Blind woman, deaf man, jackdaw fool.
Let the Lord of Chaos rule.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #1 on Wed 04 Apr 2007 07:28 PM (UTC)
Message
http://www.gammon.com.au/mushclient/regexp.htm and http://www.gammon.com.au/mushclient/funwithtriggers.htm for the help files on regex.

For that first part, it's pretty simple once you understand regex. ^\<(\d+)\/(\d+)hp\>.*
The ^ means this has to start the line off. Anything within () is grabbed as a wildcard. The \d+ means one or more digits. And the .* at the end means anything can follow it (I had to do that, since the whole prompt wasn't posted.

The trigger line on the health_bar plugin should help a decent amount when you compare it to the two help files I listed above. http://www.gammon.com.au/mushclient/plugins/Health_Bar.xml

It is much easier to fight for one's ideals than to live up to them.
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.


9,719 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.