Yuari
Documentation
Docs/Regex

Regex

Lua pattern objects and escaping.

Compiles a regex object with Match, MatchMany and Replace.

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

Escapes regex metacharacters.

print(Regex.Escape("1+1=2"))

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

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

Returns every non-overlapping match in text.

local re = Regex.new("(%a+)")
for _, match in ipairs(re:MatchMany("hello world")) do
    print(match)
end

Returns text with the first regex match replaced.

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

Returns whether the regex object is valid and an optional error message.

local re = Regex.new("(%a+)")
print(re:Status())