group
group: (Matcher, string) -> string?Named group name's text, or nil.
Pattern.compile(…):matcher(…)| Method | Returns | Description |
|---|---|---|
group(string) | string? | Named group name's text, or nil. |
start(string) | number | Where named group name starts, or -1. |
end_(string) | number | end(name), spelled end_ because Luau reserves end: where named group name ends, or -1. |
find() | boolean | (Matcher) -> boolean: The next match: from the region start, or after the previous match. |
find(number) | boolean | |
matches() | boolean | Whether the whole region matches. |
lookingAt() | boolean | Whether a match starts at the region start. |
reset() | Matcher | (Matcher) -> Matcher: Forget the position and the region; this matcher. |
reset(string) | Matcher | |
replaceAll(string) | string | The text with every match replaced ($1, ${name}, \$ in replacement). Leaves the matcher after its last (failed) find. |
replaceFirst(string) | string | The text with the first match replaced. Leaves the matcher on that match. |
appendReplacement({string}, string) | Matcher | Append the text since the last append, then the expanded replacement ($1, ${name}), to sb as one more element; this matcher. sb i… |
appendTail({string}) | {string} | Append the rest of the text to sb (a Luau array of parts, as for appendReplacement); sb. |
region(number, number) | Matcher | Search only start..end (UTF-16 indices); this matcher. |
regionStart() | number | The region's start. |
regionEnd() | number | The region's end. |
hasTransparentBounds() | boolean | Whether lookaround sees past the region. |
useTransparentBounds(boolean) | Matcher | Let lookaround and \b see past the region (default false); this matcher. |
hasAnchoringBounds() | boolean | Whether ^/$ match at the region's bounds. |
useAnchoringBounds(boolean) | Matcher | Let ^/$ match at the region's bounds (default true); this matcher. |
pattern() | Pattern | The pattern: the very Pattern it was made from (or last given to usePattern). |
usePattern(Pattern) | Matcher | Match with pattern from here on: the position and region kept, the groups forgotten (group() is nil until the next match, start() sti… |
toMatchResult() | MatchResult | A snapshot of the current match: a MatchResult that shares the text and does not move. |
matchResults() | {MatchResult} | The remaining results: every match left, as a 1-based array of MatchResult snapshots. It is eager: it finds every match now and leaves th… |
toString() | string | java.util.regex.Matcher[pattern=.. region=a,b lastmatch=..]. |
quoteReplacement(string) | string | s with \ and $ escaped, for a literal replacement. |
| Method | Returns | Description |
|---|---|---|
Pattern.matcher | Matcher | A matcher of this pattern over input. |
groupgroup: (Matcher, string) -> string?Named group name's text, or nil.
startstart: (Matcher, string) -> numberWhere named group name starts, or -1.
end_end_: (Matcher, string) -> numberend(name), spelled end_ because Luau reserves end: where named group name ends, or -1.
Luau reserves end, so this member is spelled end_; it behaves exactly as end.
findfind: ((Matcher) -> boolean) & ((Matcher, number) -> boolean)(Matcher) -> boolean: The next match: from the region start, or after the previous match.
(Matcher, number) -> boolean: Reset, then the first match at or after start.
matchesmatches: (Matcher) -> booleanWhether the whole region matches.
lookingAtlookingAt: (Matcher) -> booleanWhether a match starts at the region start.
resetreset: ((Matcher) -> Matcher) & ((Matcher, string) -> Matcher)(Matcher) -> Matcher: Forget the position and the region; this matcher.
(Matcher, string) -> Matcher: Match input from the start; this matcher.
replaceAllreplaceAll: (Matcher, string) -> stringThe text with every match replaced ($1, ${name}, \$ in replacement). Leaves the matcher after its last (failed) find.
replaceFirstreplaceFirst: (Matcher, string) -> stringThe text with the first match replaced. Leaves the matcher on that match.
appendReplacementappendReplacement: (Matcher, {string}, string) -> MatcherAppend the text since the last append, then the expanded replacement ($1, ${name}), to sb as one more element; this matcher. sb is a Luau array of parts, which table.concat(sb) joins.
appendTailappendTail: (Matcher, {string}) -> {string}Append the rest of the text to sb (a Luau array of parts, as for appendReplacement); sb.
regionregion: (Matcher, number, number) -> MatcherSearch only start..end (UTF-16 indices); this matcher.
regionStartregionStart: (Matcher) -> numberThe region's start.
regionEndregionEnd: (Matcher) -> numberThe region's end.
hasTransparentBoundshasTransparentBounds: (Matcher) -> booleanWhether lookaround sees past the region.
useTransparentBoundsuseTransparentBounds: (Matcher, boolean) -> MatcherLet lookaround and \b see past the region (default false); this matcher.
hasAnchoringBoundshasAnchoringBounds: (Matcher) -> booleanWhether ^/$ match at the region's bounds.
useAnchoringBoundsuseAnchoringBounds: (Matcher, boolean) -> MatcherLet ^/$ match at the region's bounds (default true); this matcher.
patternpattern: (Matcher) -> PatternThe pattern: the very Pattern it was made from (or last given to usePattern).
usePatternusePattern: (Matcher, Pattern) -> MatcherMatch with pattern from here on: the position and region kept, the groups forgotten (group() is nil until the next match, start() still the last match's); this matcher.
toMatchResulttoMatchResult: (Matcher) -> MatchResultA snapshot of the current match: a MatchResult that shares the text and does not move.
matchResultsmatchResults: (Matcher) -> {MatchResult}The remaining results: every match left, as a 1-based array of MatchResult snapshots. It is eager: it finds every match now and leaves the matcher after the last (for the first match alone, call find()).
toStringtoString: (Matcher) -> stringjava.util.regex.Matcher[pattern=.. region=a,b lastmatch=..].
quoteReplacementquoteReplacement: (string) -> strings with \ and $ escaped, for a literal replacement.