I'm attempting to put together a good channel capture script for IRE games. I started with the very helpful thread where Nick gave triggers and VBscript for parsing the channels. I converted the VBscript to a couple lines of Lua, and it works great for converting the newlines to spaces.
My problem isn't so much with Lua, I guess. I need a regular expression that can pick up the right strings to capture. I'll provide a few examples to illustrate my problem.
The first matches with Nick's pattern. The second won't match using Nick's pattern because of the extra set of quotes. People quote other people all the time, so this is a common problem.
What I'm looking for is a pattern that can match everything until the last quote and "end-of-buffer" character, I think. My matches either pick up nothing or far too much.
Here, wildcard 1 is the channel name, wildcard 2 is the name of the person talking, and wildcard 3 is what they said. I tried changing the [^"]+ to something like (?:.|\n)+, and it doesn't do what I want.
My problem isn't so much with Lua, I guess. I need a regular expression that can pick up the right strings to capture. I'll provide a few examples to illustrate my problem.
3519h, 4158m, 16495e, 17800w ex-
(Hashan): Person says, "Hm.. Weird, isn't mending salve supposed to mend both
legs at once?"
3519h, 4158m, 16495e, 17800w ex-
(The Hashanite Legion): Person says, "Person tells you, "Go away now!""
3519h, 4158m, 16495e, 17800w ex-The first matches with Nick's pattern. The second won't match using Nick's pattern because of the extra set of quotes. People quote other people all the time, so this is a common problem.
What I'm looking for is a pattern that can match everything until the last quote and "end-of-buffer" character, I think. My matches either pick up nothing or far too much.
<triggers>
<trigger
enabled="y"
group="IronCapture"
lines_to_match="10"
match="\((.+?)\)\: (\w+) says?\, "([^"]+)"\Z"
multi_line="y"
name="cap_channel"
regexp="y"
script="OnChat"
sequence="100" />
</triggers>
function OnChat(name, line, wildcards)
msg = wildcards[1] .. " <" .. wildcards[2] .. "> - " .. string.gsub(string.gsub(wildcards[3], "\n", " "), " ", " ") .. "\r\n"
AppendToNotepad("Channels", msg)
endHere, wildcard 1 is the channel name, wildcard 2 is the name of the person talking, and wildcard 3 is what they said. I tried changing the [^"]+ to something like (?:.|\n)+, and it doesn't do what I want.