Crates.io | strscan |
lib.rs | strscan |
version | 0.1.1 |
source | src |
created_at | 2015-06-22 02:13:28.895357 |
updated_at | 2015-12-11 23:56:18.321051 |
description | Simple rust library for matching text against regular expressions for use in lexers or other software. |
homepage | |
repository | https://github.com/luke-gru/rs_strscan |
max_upload_size | |
id | 2441 |
size | 10,018 |
Simple rust library for matching text against regular expressions for use in lexers or other software.
extern crate strscan;
use strscan::StringScanner;
let s = StringScanner::new(input_string);
let r_chars = Regex::new(r"\A\s*(\w+)\s*")
let res = s.scan(r_chars)
println!("chars with possible space: {}", res.unwrap());
println!("chars: {}", s.match_at(1).unwrap());
Uses the 'collections' feature in order to use unstable string APIs (namely String#slice_chars). Rust nightly only.
Latest tests with rustc 1.2.0-nightly (c6b148337 2015-06-12).