Yuari
Documentation
Docs/Regex/Regex:Match

Regex:Match

Returns the first match in text, or nil when nothing matches.

Syntax

Regex:Match(text: string) -> string

Parameters

ParameterTypeDescription
textstringThe text value to process.

Returns

TypeDescription
stringThe first match in text, or nil when nothing matches

Description

Regex:Match is part of the Regex library. Regex wraps a compiled pattern object. Matching and replacement follow the module's regex engine rather than Lua patterns.

The call is read-only: it resolves the current value when invoked and does not change the underlying state.

Example

local re = Regex.new("(%a+)")
print(re:Match("hello 123"))

Notes

  • Regex patterns use the module's engine; refer to its flag syntax rather than Lua patterns.