OxL Справочник OxL
РусскийEnglish

method Regex.captures

The first match with its groups.

Example:

oxl✓ проверяется в CI
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")
  }
}
Вывод
a -> 1
pub(api) fn captures(s: str) -> Captures?

Сложность. O(n) in the length of the text.

С версии. 1.0.0-beta

Параметры

ИмяТип
sstr

Возвращает

Captures?

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/core/text.oxl:1333

См. также