Regex.new
Creates a Regex object for a pattern.
The object exposes lowercase match, search and replace methods. This engine is separate from Luau string patterns; unsupported regex syntax may fail to match. The live-object pool is capped at 1,024 entries and can retire the oldest object.
Regex.new(pattern: string): RegexParameters
| Parameter | Type | Description |
|---|---|---|
pattern | string | Pattern for the bundled regex engine. |
See Regex for the object’s members.
Example
local pattern = Regex.new("[0-9]+")
local result = pattern:search("item 42")
print(type(result))Example output
table