#regex #onig

oniguruma

Rust bindings for the Oniguruma regular expressions library

3 releases (breaking)

Uses old Rust 2015

0.3.1 Dec 28, 2015
0.3.0 Dec 27, 2015
0.2.0 Dec 25, 2015
0.1.0 Dec 24, 2015

#382 in #regex

23 downloads per month

MIT license

35KB
759 lines

Rust bindings for the Oniguruma regular expressions library.

Documentation

Oniguruma Syntax Reference

How to install

In Cargo.toml:

[dependencies]
oniguruma = "0.1"

In src/main.rs:

extern crate oniguruma;

Example of usage

use oniguruma::Regex;

let regex = Regex::new("e(l+)").unwrap();
for (i, pos) in regex.captures("hello").unwrap().iter_pos().enumerate() {
    match pos {
         Some((beg, end)) =>
             println!("Group {} captured in position {}:{}", i, beg, end),
         None =>
             println!("Group {} is not captured", i)
    }
}

lib.rs:

Rust bindings for the Oniguruma regular expressions library.

Example of usage:

use oniguruma::Regex;

let regex = Regex::new("e(l+)").unwrap();
for (i, pos) in regex.captures("hello").unwrap().iter_pos().enumerate() {
    match pos {
         Some((beg, end)) =>
             println!("Group {} captured in position {}:{}", i, beg, end),
         None =>
             println!("Group {} is not captured", i)
    }
}

Dependencies

~185KB