Lua API
On this page

Regex

Inherits from

Tip

This is a builtin dotnet type. The documentation and api interface are generated from dotnet source files.

Represents an immutable regular expression.

Fields:

Options RegexOptions

read only

Gets the options that were passed into the Regex constructor.

RightToLeft boolean

read only

Gets a value that indicates whether the regular expression searches from right to left.

Constructors:

New(pattern: string) :

Initializes a new instance of the Regex class for the specified regular expression.

Parameters:
NameTypeDefaultSummary
patternstring

The regular expression pattern to match.

New(pattern: string, options: RegexOptions) :

Initializes a new instance of the Regex class for the specified regular expression, with options that modify the pattern.

Parameters:
NameTypeDefaultSummary
patternstring

The regular expression pattern to match.

optionsRegexOptions

A bitwise combination of the enumeration values that modify the regular expression.

New(pattern: string, options: RegexOptions, matchTimeout: TimeSpan) :

Initializes a new instance of the Regex class for the specified regular expression, with options that modify the pattern and a value that specifies how long a pattern matching method should attempt a match before it times out.

Parameters:
NameTypeDefaultSummary
patternstring

The regular expression pattern to match.

optionsRegexOptions

A bitwise combination of the enumeration values that modify the regular expression.

matchTimeoutTimeSpan

A time-out interval, or InfiniteMatchTimeout to indicate that the method should not time out.

Methods:

Escape(str: string) : string

static

Escapes a minimal set of characters (\, *, +, ?, |, {, [, (,), ^, $, ., #, and white space) by replacing them with their escape codes. This instructs the regular expression engine to interpret these characters literally rather than as metacharacters.

Parameters:
NameTypeDefaultSummary
strstring

The input string that contains the text to convert.

Returns:string

GetGroupNames() : string

Returns an array of capturing group names for the regular expression.

Returns:string

GetGroupNumbers() : number

Returns an array of capturing group numbers that correspond to group names in an array.

Returns:number

GetPropertyKeys() : string[]

Returns a list of strings of all public property / field names. Useful for reflection on UserData in lua scripts

Returns:string[]

GroupNameFromNumber(i: number) : string

Gets the group name that corresponds to the specified group number.

Parameters:
NameTypeDefaultSummary
inumber

The group number to convert to the corresponding group name.

Returns:string

GroupNumberFromName(name) name string

ToString()

Unescape(str) str string