Incidentally, Lua regular expressions use % as a special character (eg. %a for alphabetic characters) thus getting around the need to double the number of backslashes in quoted strings.
You need to be cautious with backslashes in the "send" field of triggers and aliases in MUSHclient.
MUSHclient automatically handles things like \n in the Send field and translates them into a linefeed. Thus, to actually send \ you need to put \\ there.
However if using Lua scripting, Lua also turns \\ into \, so to do something like a Note that notes a single \, and using "send to script" you actually have to do this:
Note ("\\\\")
MUSHclient converts \\\\ to \\ before handing it off to Lua, and Lua converts \\ to \, which is what gets printed.
This makes doing PCRE regular expressions a bit fiddly. One way is to use the script file (rather than "send to script") which halves the number of backslashes you need.
Then inside the script file, if you need to make a regular expression you could use multi-line comments, which then removes the need to escape backslashes at all. For example:
AMEND(last time):
I tried to do same with rex_pcre, it seem got a right value. I guess i have to put double backslash next time to have a correct value. :p
Can you clarify which rex_pcre library you are referring to? There is an inbuilt PCRE matcher in MUSHclient (virtually unchanged from the one from the PCRE web site), which is used in both trigger and alias matching, as well as the inbuilt "rex" library, see this link:
There is also the Lua regular expression matching which is something different again.
Now you mention rex_pcre, is that a DLL you got from a Lua site? If so it is possibly a different version of PCRE to the one I am using. The presence of the parentheses is puzzling however.
Amended on Tue 25 Dec 2007 04:08 PM (UTC) by Maxhrk
Message
This experiment that i want to find out how good Rex_pcre lib is... since it probably very new library. Nevertheless I found something interesting while playing with this kind of experiment.
Also this experiment also including by go against mushclient's trigger's regex pattern matching.
the
this is lua code i use to check the wildcards. as usual everybody no doubt everybody use it anyway!
for key, value in pairs(wildcards) do
if type(value) == "boolean" then
print("KEY:" .. key .. " value:" .. tostring(value))
else
print("KEY:" .. key .. " value:" .. value)
end --if
end --if
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.