Function rustml::io::match_lines_stdin
[−]
[src]
pub fn match_lines_stdin(r: Regex) -> MatchLines<Stdin>
Returns an instance of MatchLines
which can be used to read all
lines from stdin
and match each line with the provided regex. Only
those lines are returned which match the regex.
Example
#[macro_use] extern crate rustml; extern crate regex; use regex::Regex; use rustml::io::match_lines; let r = Regex::new(r"^[a-z]+ (\d+)$").unwrap(); for line in match_lines(r) { let captures = line.unwrap(); println!("{}", captures[1]); }