A LuaRegexMatch object provides information about the matches for a regular expression found in a string. For example, the regex_search function returns a LuaRegexMatch object.
If a match is found for a regular expression at multiple points in the string, you can use the next() method to get a LuaRegexMatch object for the next match.
If the regular expression contained sub-expressions (surrounded by parentheses) the methods of LuaRegexMatch objects can also be used to retrieve information about the sub-expression matches.
If you have a LuaRegexMatch object called match you can call its methods using the ":" operator. For example:
match:length()| Method | Description | 
|---|---|
| length | Returns the length of the sub match. | 
| next | Returns a LuaRegexMatch for the next match. | 
| position | Returns the position of the sub match as an index from 1. | 
| size | Returns the number of sub matches for the current match. | 
| str | Returns the string for the sub match. | 
|  |