Skip to content

luxe API (2025.1.2)


luxe: regex module


RegexInfo

import "luxe: regex" for RegexInfo

A regular expression result, containing one or more matches


RegexInfo.matched returns Bool

True if there was any match

RegexInfo.match returns List

Returns the match results, a List of RegexMatch. Only valid if matched is true

RegexInfo [index : Num] returns RegexMatch

Convenience to access a specific match by index

RegexMatch

import "luxe: regex" for RegexMatch

A single match in a regular expression result.


RegexMatch.subcount returns Num

Number of sub matches (groups), not including 0 which is the full match

RegexMatch.string returns String

The matched string

RegexMatch.offset returns Num

The offset of the match in the original string

RegexMatch.count returns Num

The length of the match string

RegexMatch.index returns Num

Index of this match in the match results

RegexMatch [index : Num] returns RegexSubMatch

Access to a specific group/sub match by index. 0 is the full match, groups are 1-indexed

RegexSubMatch

import "luxe: regex" for RegexSubMatch

A single group/sub match in a regular expression match.


RegexSubMatch.count returns Num

The length of the sub/group

RegexSubMatch.offset returns Num

The offset of the sub/group in the original match

RegexSubMatch.string returns String

The string of the sub/group

RegexSubMatch.index returns Num

The index of this sub/group in the match

RegexSubMatch [index : Num] returns Any

Returns info about this sub match by index. 0 returns count, 1 returns offset, 2 returns string