Regex
Create Java-style regular expressions, find matching substrings, and replace the first match. These patterns use regex syntax rather than Luau string-pattern syntax.
Functions
Regex:MatchFind the first substring that satisfies this compiled pattern. Use it when you want one hit, or pair it with anchors to validate a complete input.
Regex:MatchManyCollect successive matches into one array. This works well for extracting several tokens from a short piece of text without writing a manual search loop.
Regex:ReplaceReplace the first match of a compiled pattern and return a new string. It is useful for a targeted edit, such as rewriting one prefix while preserving the rest of a line.
Regex.EscapeMake user-provided text safe to place inside a regular expression as a literal. Punctuation such as dots and brackets will match itself instead of gaining regex meaning.
Regex.newCompile a Java regular expression once, then reuse it for searches or replacements. This is useful when you repeatedly inspect values with the same pattern, such as an identifier or a version string.