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 ➜ reg exp problem

reg exp problem

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


Posted by DavidM   (5 posts)  Bio
Date Tue 15 Jun 2004 04:02 AM (UTC)
Message
This is a new twist to a old problem. Recently, there was a small change made to the line "A prickly stinging overcomes your body, fading away into numbness." Before, *'s replaced random letters in the message giving you something like "A p*ickly stinging ov*rcomes yo*r body, fad*ng away into numbness." I searched the forums and found this trigger made by Ked which worked perfectly:

^((?:A|\*)(?: |\*)(?:p|\*)(?:r|\*)(?:i|\*)(?:c|\*)(?:k|\*)(?:l|\*)(?:y|\*)(?: |\*)(?:s|\*)(?:t|\*)(?:i|\*)(?:n|\*)(?:g|\*)(?:i|\*)(?:n|\*)(?:g|\*)(?: |\*)(?:o|\*)(?:v|\*)(?:e|\*)(?:r|\*)(?:c|\*)(?:o|\*)(?:m|\*)(?:e|\*)(?:s|\*)(?: |\*)(?:y|\*)(?:o|\*)(?:u|\*)(?:r|\*)(?: |\*)(?:b|\*)(?:o|\*)(?:d|\*)(?:y|\*)(?:\,|\*)(?: |\*)(?:f|\*)(?:a|\*)(?:d|\*)(?:i|\*)(?:n|\*)(?:g|\*)(?: |\*)(?:a|\*)(?:w|\*)(?:a|\*)(?:y|\*)(?: |\*)(?:i|\*)(?:n|\*)(?:t|\*)(?:o|\*)(?: |\*)(?:n|\*)(?:u|\*)(?:m|\*)(?:b|\*)(?:n|\*)(?:e|\*)(?:s|\*)(?:s|\*)(?:\.|\*))$

Now, however, the *'s can replace two random letters in the message giving you something like this "A pri*ly stinging overcomes your body, fading *ay into numbne*." (Where the *'s replace both the C and K in prickly, the A and W in away, and the two S's in numbness). I tried to use this trigger:

^((A|\*|)(?: |\*|)(?:p|\*|)(?:r|\*|)(?:i|\*|)(?:c|\*|)(?:k|\*|)(?:l|\*|)(?:y|\*|)(?: |\*|)(?:s|\*|)(?:t|\*|)(?:i|\*|)(?:n|\*|)(?:g|\*|)(?:i|\*|)(?:n|\*|)(?:g|\*|)(?: |\*|)(?:o|\*|)(?:v|\*|)(?:e|\*|)(?:r|\*|)(?:c|\*|)(?:o|\*|)(?:m|\*|)(?:e|\*|)(?:s|\*|)(?: |\*|)(?:y|\*|)(?:o|\*|)(?:u|\*|)(?:r|\*|)(?: |\*|)(?:b|\*|)(?:o|\*|)(?:d|\*|)(?:y|\*|)(?:\,|\*|)(?: |\*|)(?:f|\*|)(?:a|\*|)(?:d|\*|)(?:i|\*|)(?:n|\*|)(?:g|\*|)(?: |\*|)(?:a|\*|)(?:w|\*|)(?:a|\*|)(?:y|\*|)(?: |\*|)(?:i|\*|)(?:n|\*|)(?:t|\*|)(?:o|\*|)(?: |\*|)(?:n|\*|)(?:u|\*|)(?:m|\*|)(?:b|\*|)(?:n|\*|)(?:e|\*|)(?:s|\*|)(?:s|\*|)(?:\.|\*|))$

and it matches the line perfectly, but I now get an error when I get a line of only asteriks. Is there another way I should go about triggering this line? Or some way to modify this one to stop getting the error message? Thanks in advance
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 15 Jun 2004 04:20 AM (UTC)
Message
You could filter out the line of only asterisks using a trigger with a lower sequence number, something like this:

Match: ^\*+$

That will match a line of one or more asterisks.

Give that a lower priority (eg. 90) and it will stop the main trigger from firing.

- Nick Gammon

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

Posted by DavidM   (5 posts)  Bio
Date Reply #2 on Tue 15 Jun 2004 04:36 AM (UTC)

Amended on Tue 15 Jun 2004 04:42 AM (UTC) by Nick Gammon

Message
Ok, I used that trigger and it helped with lines that are filled with asteriks but now I found another problem. I get the same error message when I get something like this:
Well-tended grass.


     ***,,,,,,,,#,,      
     * **Y   | * |,      
     **.          Y,,    
-------------------\,^+--
******|* *|| *  *|*|,^||*
******Y*Y | * *   ||,^|*|
    *Y Y Y| @?    Y|#-+--
*****|Y Y | * *   *|,,;; 
*****|* **|| *   Y |;,   
-------------------/;; ~ 
       ***,***,***,*;  ~ 
       ***,*Y*,***|*; ~~ 
       ***,***,***,*;;;~ 


Not sure how I can make a trigger for something like this. These are the error messages I'm getting.

Error executing regular expression

Could not decompress text from MUD: -5
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 15 Jun 2004 04:39 AM (UTC)
Message
Another approach would be to add a lookahead assertion, like this:

^(?!\*\*\*\*\*\*)((A|\*|)(?: |\*|)(?:p|\*|)(?:r|\*|)(?:i|\*|)(?:c|\*|)(?:k|\*|)(?:l|\*|)(?:y|\*|)(?: |\*|)(?:s|\*|)(?:t|\*|)(?:i|\*|)(?:n|\*|)(?:g|\*|)(?:i|\*|)(?:n|\*|)(?:g|\*|)(?: |\*|)(?:o|\*|)(?:v|\*|)(?:e|\*|)(?:r|\*|)(?:c|\*|)(?:o|\*|)(?:m|\*|)(?:e|\*|)(?:s|\*|)(?: |\*|)(?:y|\*|)(?:o|\*|)(?:u|\*|)(?:r|\*|)(?: |\*|)(?:b|\*|)(?:o|\*|)(?:d|\*|)(?:y|\*|)(?:\,|\*|)(?: |\*|)(?:f|\*|)(?:a|\*|)(?:d|\*|)(?:i|\*|)(?:n|\*|)(?:g|\*|)(?: |\*|)(?:a|\*|)(?:w|\*|)(?:a|\*|)(?:y|\*|)(?: |\*|)(?:i|\*|)(?:n|\*|)(?:t|\*|)(?:o|\*|)(?: |\*|)(?:n|\*|)(?:u|\*|)(?:m|\*|)(?:b|\*|)(?:n|\*|)(?:e|\*|)(?:s|\*|)(?:s|\*|)(?:\.|\*|))$

I modified the start of the regexp to add an assertion that it does *not* start with "******". Then the rest is the same.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 15 Jun 2004 04:41 AM (UTC)
Message
Quote:

Could not decompress text from MUD: -5


Did you get that on the regexp you showed above, or a different one?

- Nick Gammon

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

Posted by DavidM   (5 posts)  Bio
Date Reply #5 on Tue 15 Jun 2004 04:45 AM (UTC)

Amended on Tue 15 Jun 2004 04:47 AM (UTC) by DavidM

Message
The one I showed above. I get that when I use both methods. The one with the lower priority, and the one with the lookahead assertion
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #6 on Tue 15 Jun 2004 04:47 AM (UTC)
Message
I tried that text and didn't get an error message. Do you have other triggers? What version of MUSHclient are you using?

- Nick Gammon

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

Posted by DavidM   (5 posts)  Bio
Date Reply #7 on Tue 15 Jun 2004 04:49 AM (UTC)

Amended on Tue 15 Jun 2004 04:51 AM (UTC) by DavidM

Message
I have tons of other trigger but I don't think it's any of them because these error messages started after I changed the trigger we are talking about now and I'm only getting the error on things that have asteriks in them. I'm using 3.45
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #8 on Tue 15 Jun 2004 05:32 AM (UTC)
Message
I got your error message in version 3.45 but not the latest version of MUSHclient, 3.50.

The release notes for 3.48 say, amongst other things:

Quote:

18. Speeded up regular expression matching by using the "study" feature of the PCRE code. This effectively optimises a compiled regular expression to make it execute more quickly.


This may fix your problem.

- Nick Gammon

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

Posted by DavidM   (5 posts)  Bio
Date Reply #9 on Tue 15 Jun 2004 07:37 AM (UTC)
Message
yep, that was it. The trigger now works perfectly. Thanks Nick
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.


20,343 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.