mocci the Troll is a 46th level Lord Warrior, was born on 2012/06/29, and was last logged in on Thu Aug 15 18:40:26 2013.
Set as perl regex
Added:
(\w+) the (\w+) is a (\w+) level (\d+) (\w+), was born on (\d+) / (\d+) / (\d+), <--- on perl regex
send("b " .. matches[2] .. "the" .. matches[3] .. "is a" .. matches[4] .. "level" .. matches[5] .. "" .. matches[6] ..", was born on" .. matches[7] .. "/" .. matches[8] .. "/" .. matches[9])
The echo wont spit out the information, what were I missing here? Thanks for the help in advance.
Perl Regex Help Needed
Re: Perl Regex Help Needed
Try:
That will fix what you need to accomplish here, although if you want to actually properly capture the level, do take that into account.
Code: Select all
(\w+) the (\w+) is a (\w+) level (\d+[st|nd|rd]) (\w+), was born on (\d+) / (\d+) / (\d+),
Re: Perl Regex Help Needed
You're matching (\d+) with nothing in that regex where Lord would be... and the date /'s are spaced. Also if you want to echo the information, then make sure you change that send() to an echo() or cecho().
Code: Select all
Pattern: (\w+) the (\w+) is a (\d+[st|nd|rd|th]) level (.+), was born on (\d+)/(\d+)/(\d+)
And the echo...
echo("\nb "..maches[2].." the "..matches[3].." is a "..matches[4].." level "..matches[5]..", and was born on "..matches[6].."/"..matches[7].."/"..matches[8])
Last edited by Belgarath on Fri Aug 16, 2013 5:26 pm, edited 1 time in total.
-
- Posts: 154
- Joined: Sun Jul 29, 2012 6:50 am
Re: Perl Regex Help Needed
Both of your suggestion haven't triggered anything, what I did was set up an trigger of anyone who types name.alt and it triggered my screen to enter name.alt to pull up the info. Hence another trigger, this one we are trying to solve.
send or echo wont work. Let me post snapshot here of what It looks like...
send or echo wont work. Let me post snapshot here of what It looks like...
Re: Perl Regex Help Needed
Your regex pattern is wrong.
You can use the highlighter option to visualize your capture groups or display(matches) to print the matches table.
Start off simple.
mocci the Troll is a 46th level Lord Warrior, was born on 2012/06/29, and was last logged in on Thu Aug 15
(\w+) the (\w+) is a (.*) level (.*), was born on (.*), and was last logged in on (.*)
display(matches) now looks like this:
"mocci the Troll is a 46th level Lord Warrior, was born on 2012/06/29, and was
last logged in on Thu Aug 15 18:40:26 2013.",
"mocci",
"Troll",
"46th",
"Lord Warrior",
"2012/06/29",
"Thu Aug 15 18:40:26 2013."
}
You can use the highlighter option to visualize your capture groups or display(matches) to print the matches table.
Start off simple.
mocci the Troll is a 46th level Lord Warrior, was born on 2012/06/29, and was last logged in on Thu Aug 15
(\w+) the (\w+) is a (.*) level (.*), was born on (.*), and was last logged in on (.*)
display(matches) now looks like this:
"mocci the Troll is a 46th level Lord Warrior, was born on 2012/06/29, and was
last logged in on Thu Aug 15 18:40:26 2013.",
"mocci",
"Troll",
"46th",
"Lord Warrior",
"2012/06/29",
"Thu Aug 15 18:40:26 2013."
}
-
- Posts: 154
- Joined: Sun Jul 29, 2012 6:50 am
Re: Perl Regex Help Needed
Still wont fire.
I listed in my perl regex box as following:
(\w+) the (\w+) is a (.*) level (.*), was born on (.*), and was last logged in on (.*)
listed in box below as following:
send("b "..maches[2].." the "..matches[3].." is a "..matches[4].." level "..matches[5]..", and was born on "..matches[6]..", and was last logged in on"..matches[7])
Also tried this:
display(matches)
To no avial. Wondering why...
Thanks
I listed in my perl regex box as following:
(\w+) the (\w+) is a (.*) level (.*), was born on (.*), and was last logged in on (.*)
listed in box below as following:
send("b "..maches[2].." the "..matches[3].." is a "..matches[4].." level "..matches[5]..", and was born on "..matches[6]..", and was last logged in on"..matches[7])
Also tried this:
display(matches)
To no avial. Wondering why...
Thanks
Re: Perl Regex Help Needed
Well, just to be safe, put the display(matches) as the first line in the script (so it will happen even if there is an error somewhere else).
Re: Perl Regex Help Needed
Heiko's regex works fine for me. Make sure you have the pattern set as a regex expression not something else. It should look like this
and it give these results
-
- Posts: 154
- Joined: Sun Jul 29, 2012 6:50 am
Re: Perl Regex Help Needed
Oh, I meant I wanted to report in our buddy chat channel.
Re: Perl Regex Help Needed
That is what the send line is supposed to do, yes?
Also, since you basically just want to send exactly what was matched, you can just use matches[1].
So, you could do this:
send("b " .. matches[1])
Also, since you basically just want to send exactly what was matched, you can just use matches[1].
So, you could do this:
send("b " .. matches[1])