OxL Reference

method Regex.compile

Compiles at run time; prefer the literal re"…", which is checked when the program is built.

Example:

oxl✓ checked in CI
fn main() io {
  let re = Regex.compile("[a-z]+")!
  print("{re.matches("abc")}")
}
Output
true
pub(api) static fn compile(pattern: str) -> Regex | ParseError

Since. 1.0.0-beta

Parameters

NameType
patternstr

Returns

Regex

Errors

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/text.oxl:1247

See also