This is not a bug. The first item in the string list matches, matches[1] contains the first *full match*, i. e. the first complete match of your regex pattern - or if you are using substring/begin of line substing type of triggers, matches[1] contains the pattern itself.
To get the entire line you'd have to reference the variable "line".
Example: If we get this line from the MUD
"Tom gives Jim a ride to Tom's house."
The regex pattern
Jim a (ride) to (\w+)
will get you this:
Code: Select all
line = "Tom gives Jim a ride to Tom's house."
matches[1] = "Jim a ride to Tom"
matches[2] = "ride"
matches[3] = "Tom"
Another example:
Line is:
Tom gives Jim a ride to Terry's house.
pattern:
T(\w+)
without checking the Perl /g switch option you'd get:
Code: Select all
line = "Tom gives Jim a ride to Terry's house."
matches[1] = "Tom"
matches[2] = "Tom" <---- first capture group of first match in the line
With the Perl /g switch option you'd get
Code: Select all
line = "Tom gives Jim a ride to Terry's house."
matches[1] = "Tom"
matches[2] = "Tom"
matches[3] = "Terry" <---- second *complete* match of pattern "T(\w+)"
matches[4] = "Terry" <---- first capture group of second regex match on this line