Skip to content

luxe: regex


import "luxe: regex" for RegexInfo

A regular expression result, containing one or more matches

RegexInfo.matched : Bool

True if there was any match

RegexInfo.match : List

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

RegexInfo [index : Num] : RegexMatch

Convenience to access a specific match by index

import "luxe: regex" for RegexMatch

A single match in a regular expression result.

RegexMatch.subcount : Num

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

RegexMatch.string : String

The matched string

RegexMatch.offset : Num

The offset of the match in the original string

RegexMatch.count : Num

The length of the match string

RegexMatch.index : Num

Index of this match in the match results

RegexMatch [index : Num] : RegexSubMatch

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

import "luxe: regex" for RegexSubMatch

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

RegexSubMatch.count : Num

The length of the sub/group

RegexSubMatch.offset : Num

The offset of the sub/group in the original match

RegexSubMatch.string : String

The string of the sub/group

RegexSubMatch.index : Num

The index of this sub/group in the match

RegexSubMatch [index : Num] : Any

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