Skip to content

Regex

Reference for the regex API.

Functions

regex

Create a regex instance with a given pattern.

lua
---@param pattern string
function regex(pattern): regex

Types

find_all

lua
---@param subject string
function regex:find_all(subject): string[][]

Examples

lua
local r = regex('a*b')
print(r.find_all('aaab aab ab')) -- {{"aaab"}, {"aab"}, {"ab"}}