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 ➜ Plugins ➜ Regex Error in newest Mushclient/addxml.trigger

Regex Error in newest Mushclient/addxml.trigger

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


Posted by Mendaloth   (14 posts)  Bio
Date Fri 13 Jan 2012 01:27 AM (UTC)
Message
The following code:
	addxml.trigger {  match = "^(.*?) looks very uncomfortable\.$", 
							regexp = true,
							sequence = 50,
							enabled = false,
							omit_from_output = false,
							name = key,
							script = "Process_Study_Message",
							group="study_triggers"
}


Produces this error:


Compile error
Plugin: Miniwindow_Plugin (called from world: Aardwolf)
Immediate execution
[string "Plugin"]:249: invalid escape sequence near '"^(.*?) looks very uncomfortable'
Error context in script:  
 249*:   addxml.trigger {  match = "^(.*?) looks very uncomfortable\.$", 
 250 :        regexp = true,
 251 :        sequence = 50,
 252 :        enabled = false,
 253 :        omit_from_output = false,


I know since the latest version of Mushclient it has been much more picky about regex errors, but for the life of me I can't figure out what the issue is here. It is actually an exact copy from a trigger that was created by convert to regex option.

Top

Posted by Mendaloth   (14 posts)  Bio
Date Reply #1 on Fri 13 Jan 2012 01:45 AM (UTC)
Message
I should add that it worked fine under previous versions of Mushclient.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 13 Jan 2012 03:24 AM (UTC)
Message
I don't get an error executing that in the Immediate window.

Template:version Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.

- Nick Gammon

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

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #3 on Fri 13 Jan 2012 03:32 AM (UTC)

Amended on Fri 13 Jan 2012 03:44 AM (UTC) by Fiendish

Message
Quote:
I don't get an error executing that in the Immediate window.
You would with Lua 5.2.

The Aardwolf MUSHclient Package uses Lua 5.2 semantics now, and Lua 5.2 strictly rejects invalid string escape sequences whereas 5.1.4 just used the literal follower.

To fix your pattern you need to change that \. to \\. because \. is not a valid string escape sequence. Keep in mind that your pattern is a string first and only becomes a regular expression after initial parsing. Even though you weren't getting an error before, I'm pretty sure it wasn't giving you quite the regex pattern you expected.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #4 on Fri 13 Jan 2012 04:04 AM (UTC)
Message
Alternatively, use longstrings, which don't have escape sequences.

[[^(.*?) looks very uncomfortable\.$]]

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 13 Jan 2012 05:57 AM (UTC)
Message
Fiendish said:

You would with Lua 5.2.


Which isn't officially supported by MUSHclient.

There have been so many changes to Lua 5.2, including incompatibilities with existing DLLs that I have chosen to stay away from it.

I thought when I saw that string that perhaps the backslash should be double-escaped, but since I couldn't reproduce it, I didn't say that.

- Nick Gammon

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

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #6 on Fri 13 Jan 2012 04:10 PM (UTC)
Message
Nick Gammon said:

Fiendish said:

You would with Lua 5.2.


Which isn't officially supported by MUSHclient.

I try telling people to come to me first because of this, but they don't always listen. Sorry about the spillover.

https://github.com/fiendish/aardwolfclientpackage
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,894 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.