method Regex.captures
The first match with its groups.
Example:
fn main() io {
let re = Regex.compile("(\\w+)=(\\w+)")!
match re.captures("a=1 b=2") {
c? => print("{c.text(1)!} -> {c.text(2)!}")
none => print("no match")
}
}Output
a -> 1
pub(api) fn captures(s: str) -> Captures?Complexity. O(n) in the length of the text.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
s | str |
Returns
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/text.oxl:1333