class · System.Text

Regex

public class System.Text.Regex : System.Any

A compiled pattern.

Kind
class
Namespace
System.Text
Assembly
System.Core
Access
public, final
Source file
Regex.ant

Inheritance

Base classes
Any Regex

Constructors

constructor Regex(pattern: System.String<u8>)
#

Properties

property Pattern: System.String<u8>
#

read-only

Methods

method IsMatch(input: System.String<u8>) -> bool
#

Whether the pattern matches somewhere in input.

static method IsMatch(input: System.String<u8>, pattern: System.String<u8>) -> bool
#

static

The first match in input (Success false when there is none).

method Match(input: System.String<u8>, from: i32) -> System.Text.Match
#

The first match in input at or after from.

method Matches(input: System.String<u8>) -> System.List<System.Text.Match>
#

Every match in input, left to right (an empty match moves on by one unit).

method Replace(input: System.String<u8>, replacement: System.String<u8>) -> System.String<u8>
#

input with every match replaced by replacement ($1…$9 in it stand for the groups, $0 for the match).

Private and internal members (27)

field root: System.Text.RegexNode
#

private

field groups: i32
#

private

field pattern: System.String<u8>
#

private

field first: u8[]
#

private

field prefilter: bool
#

private

field anchored: bool
#

private

field repeats: i32
#

private

field counts: i32[]
#

private

field iterationStarts: i32[]
#

private

field memoizable: bool
#

private

field tails: i32
#

private

field failed: u64[]
#

private

field failedText: u8[]
#

private

field remember: bool
#

private

field s: u8[]
#

private

field starts: i32[]
#

private

field ends: i32[]
#

private

field matchEnd: i32
#

private

static method Scan(node: System.Text.RegexNode, table: u8[]) -> bool
#

private static

Whether a node can match without taking a unit; the units it can start with are added to table.

method Run(start: System.Text.RegexNode, at: i32) -> i32
#

private

method Branch(node: System.Text.RegexNode, pos: i32) -> i32
#

private

The nodes that may try more than one way on: the end, alternatives, groups and repeats.

method Takes(atom: System.Text.RegexNode, at: i32) -> bool
#

private

Whether a single-unit atom (a literal, a class or .) takes the unit at at.

method RunUnits(node: System.Text.RegexNode, pos: i32) -> i32
#

private

A repeat of a single-unit atom, as a loop over the run of units it takes rather than a call per unit (a long text would exhaust the stack): greedy takes the longest run and backs off one unit at a time while the rest fails (only to where the next literal is, when a literal follows); lazy starts from the minimum and takes one more unit at a time.

method Iterate(node: System.Text.RegexNode, pos: i32, count: i32, last: i32) -> i32
#

private

A repeat of more than one unit at pos: count iterations are done; last is where the last one started (-1 at first).

method Again(node: System.Text.RegexNode, pos: i32, count: i32) -> i32
#

private

One more iteration of a repeat from pos, after count (put back when it fails).

Inherited members (5)

Source

Regex as Larva HIR, decompiled from its Larva HIR.

System.Text.Regex.hir
// A compiled pattern.
public class System.Text.Regex : System.Any
{
    field root: System.Text.RegexNode
    field groups: i32
    field pattern: System.String<u8>
    field first: u8[]
    field prefilter: bool
    field anchored: bool
    field repeats: i32
    field counts: i32[]
    field iterationStarts: i32[]
    field memoizable: bool
    field tails: i32
    field failed: u64[]
    field failedText: u8[]
    field remember: bool
    field s: u8[]
    field starts: i32[]
    field ends: i32[]
    field matchEnd: i32
    // Whether a node can match without taking a unit; the units it can start with are added to `table`.
    static method Scan(node: System.Text.RegexNode, table: u8[]) -> bool
    // Links a parsed node to what follows it (`next`): its entry, the node matching starts it with.
    method Link(node: System.Text.RegexNode, next: System.Text.RegexNode) -> System.Text.RegexNode
    method Run(start: System.Text.RegexNode, at: i32) -> i32
    // The nodes that may try more than one way on: the end, alternatives, groups and repeats.
    method Branch(node: System.Text.RegexNode, pos: i32) -> i32
    // Whether a single-unit atom (a literal, a class or `.`) takes the unit at `at`.
    method Takes(atom: System.Text.RegexNode, at: i32) -> bool
    // A repeat of a single-unit atom, as a loop over the run of units it takes rather than a call per unit (a
    // long text would exhaust the stack): greedy takes the longest run and backs off one unit at a time while
    // the rest fails (only to where the next literal is, when a literal follows); lazy starts from the minimum
    // and takes one more unit at a time.
    method RunUnits(node: System.Text.RegexNode, pos: i32) -> i32
    // A repeat of more than one unit at `pos`: `count` iterations are done; `last` is where the last one started
    // (-1 at first).
    method Iterate(node: System.Text.RegexNode, pos: i32, count: i32, last: i32) -> i32
    // One more iteration of a repeat from `pos`, after `count` (put back when it fails).
    method Again(node: System.Text.RegexNode, pos: i32, count: i32) -> i32
    // The first match from `from` on: its start (-1 when none); its end in matchEnd.
    method Search(text: u8[], from: i32) -> i32
    constructor Regex(pattern: System.String<u8>)
    // Whether the pattern matches somewhere in `input`.
    method IsMatch(input: System.String<u8>) -> bool
    static method IsMatch(input: System.String<u8>, pattern: System.String<u8>) -> bool
    // The first match in `input` (Success false when there is none).
    method Match(input: System.String<u8>) -> System.Text.Match
    // The first match in `input` at or after `from`.
    method Match(input: System.String<u8>, from: i32) -> System.Text.Match
    // Every match in `input`, left to right (an empty match moves on by one unit).
    method Matches(input: System.String<u8>) -> System.List<System.Text.Match>
    // `input` with every match replaced by `replacement` (`$1`…`$9` in it stand for the groups, `$0` for the match).
    method Replace(input: System.String<u8>, replacement: System.String<u8>) -> System.String<u8>
    property Pattern: System.String<u8>
}
Esc