Regex:MatchMany Synchronous

Find all successive matches of this regular expression in the supplied text. Use it to extract repeated tokens from a document. Each result is the complete match rather than a separate capture-group record.

Syntax
Luau
Regex:MatchMany(contents: string) -> {string}

Parameters

Call this method with a Regex receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

Function parameters
ParameterTypeDescription
contentsstringText to search.

Returns

{string}

An array of full matched substrings. No matches produce an empty array; capture groups are not returned separately.

Example

Example
Luau
local digits = Regex.new("[0-9]+")
for _, match in ipairs(digits:MatchMany("a12 b34")) do
    print(match) -- 12, then 34
end
Kawaii documentation