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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Regex Error in newest Mushclient/addxml.trigger

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Regex Error in newest Mushclient/addxml.trigger

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Mendaloth   (14 posts)  [Biography] bio
Date Fri 13 Jan 2012 01:27 AM (UTC)  quote  ]
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.

[Go to top] top

Posted by Mendaloth   (14 posts)  [Biography] bio
Date Reply #1 on Fri 13 Jan 2012 01:45 AM (UTC)  quote  ]
Message
I should add that it worked fine under previous versions of Mushclient.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 13 Jan 2012 03:24 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Fiendish   USA  (849 posts)  [Biography] bio   Global Moderator
Date Reply #3 on Fri 13 Jan 2012 03:32 AM (UTC)  quote  ]

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.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Reply #4 on Fri 13 Jan 2012 04:04 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 13 Jan 2012 05:57 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Fiendish   USA  (849 posts)  [Biography] bio   Global Moderator
Date Reply #6 on Fri 13 Jan 2012 04:10 PM (UTC)  quote  ]
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.

http://aardwolfclientpackage.googlecode.com/
[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.


1,135 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]