Skip to content

Regular Expressions

Functions

Return Type Name Description
regex regex(string pattern) Create a regex object

Types

regex

Return Type Name Description
string[][] findall(string subject) Finds all matches in the given subject string

Examples

-- Creating a regex object
local pattern = 'a*b'
local r = regex(pattern)

-- Finding all matches
local subject = 'aaab aab ab'
local matches = r.findall(subject)
print(matches) -- {{"aaab"}, {"aab"}, {"ab"}}