OxL Reference

method Captures.named

The group called name ((?<name>…)).

Example:

oxl✓ checked in CI
fn main() io {
  let c = Regex.compile("(?<key>[a-z]+)=(?<val>[0-9]+)")!.captures("rate=42")!
  print("{c.named("key")!.text} {c.named("val")!.text} {c.named("nope")}")
}
Output
rate 42 none
pub(api) fn named(name: str) -> Match?

Since. 1.0.0-beta

Parameters

NameType
namestr

Returns

Match?

Effects

none declared (pure unless the body says otherwise)

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

See also