Axle v0.14.1
Package

std/text/regex

std/regex — Pattern / Matcher API over the Rust regex crate.

Compile a Pattern once, then run whole-string tests (matches),
single-scan tests (find), or substitutions (replaceAll /
replaceFirst / split). For capture groups and iteration over
every match in one input, derive a Matcher and advance it with
find(), reading the current capture through the group*
accessors. The crate uses linear-time RE2-style matching, so it has
no backreferences or lookaround and cannot catastrophically
backtrack.

A Pattern owns a registry slot; it is Closeable so a
try-resources binding releases the compiled regex deterministically.

C class Pattern

A compiled regex held by registry handle. Compile once, then run
whole-string (matches) or scanning (find) queries, derive a
per-input Matcher, or rewrite via replaceAll / replaceFirst.

Constructors

TypeMethod and description
constructor(regex : string) Compiles regex (Rust regex-crate syntax) into this pattern.

Method detail

#constructor

constructor(regex : string)

Compiles regex (Rust regex-crate syntax) into this pattern.

Parameters
regex the regular expression source to compile

Methods

Method detail

#matcher

matcher(self, input : string) : Matcher

#matches

matches(self, input : string) : bool

#find

find(self, input : string) : bool

#replaceAll

replaceAll(self, input : string, replacement : string) : string

#replaceFirst

replaceFirst(self, input : string, replacement : string) : string

#split

split(self, input : string) : string

#pattern

pattern(self) : string

#close

close(self) : void ! IOException

C class Matcher

A stateful cursor bound to one input string: find() advances to
the next match, the group* accessors read the current capture,
and reset() rewinds to the start.

Methods

Method detail

#find

find(self) : bool

#matches

matches(self) : bool

#group

group(self) : string

#groupAt

groupAt(self, index : i32) : string

#groupCount

groupCount(self) : i32

#start

start(self) : i32

#end

end(self) : i32

#reset

reset(self) : void

#replaceAll

replaceAll(self, replacement : string) : string