fn extract_matches(path: &Path, rex: &Regex) -> anyhow::Result<Vec<String>> {
    let mut content = String::new();
    let mut file = File::open(path)?;
    file.read_to_string(&mut content)?;
    let mut at = 0;
    let mut res = vec![];
    while let Some(cap) = rex.captures(&content[at..]) {
        res.push(cap.get(1).unwrap().as_str().to_string());
        at += cap.get(0).unwrap().end();
    }
    Ok(res)
}
/// Extracts matches out of some text file. `rex` must be a regular expression with one anonymous
/// group.
Extracts matches out of some text file. `rex` must be a regular expression with one anonymous
group.
Extracts matches out of some text file . ` rex ` must be a regular expression with one anonymous group .
fn extract_matches(path: &Path, rex: &Regex) -> anyhow::Result<Vec<String>> {
    let mut content = String::new();
    let mut file = File::open(path)?;
    file.read_to_string(&mut content)?;
    let mut at = 0;
    let mut res = vec![];
    while let Some(cap) = rex.captures(&content[at..]) {
        res.push(cap.get(1).unwrap().as_str().to_string());
        at += cap.get(0).unwrap().end();
    }
    Ok(res)
}
fn extract_matches ( path : & Path , rex : & Regex ) -> anyhow :: Result < Vec < String > > { let mut content = String :: new ( ) ; let mut file = File :: open ( path ) ? ; file . read_to_string ( & mut content ) ? ; let mut at = 0 ; let mut res = vec ! [ ] ; while let Some ( cap ) = rex . captures ( & content [ at .. ] ) { res . push ( cap . get ( 1 ) . unwrap ( ) . as_str ( ) . to_string ( ) ) ; at += cap . get ( 0 ) . unwrap ( ) . end ( ) ; } Ok ( res ) }
Extracts matches out of some text file.
Extracts matches out of some text file .
path
&Path
rex
&Regex