Class regex

Regex support

Creating a new regex instance

To create a new regex instance, use the regex constructor:

local reg = regex{ pattern = "[1-9][0-9]*" }

assert(reg:match("7392473"))

Methods

regex:match (string)

Scan a given string for a match.

Parameters

  • string
    Type: string
    The string to scan for a match.

Return Values

  • boolean
    true if a match was found, false otherwise.

Attribution

Copyright