// highlight query word in examples
// and use &str instead
highlight query word in examples
and use &str instead
highlight query word in examples and use &str instead
fn highlight(s: &str, key: &str) {
    let exp = format!("(?P<k>{})", key);
    let re = RegexBuilder::new(exp.as_str())
        .case_insensitive(true)
        .build()
        .expect("invalid regexp");
    let result = re.replace_all(
        s,
        format!(
            "{}$k{}",
            color::Fg(color::Yellow),
            color::Fg(color::LightBlack)
        )
        .as_str(),
    );
    println!("{}", result);
}
fn highlight ( s : & str , key : & str ) { let exp = format ! ( " " key ) ; let re = RegexBuilder :: new ( exp . as_str ( ) ) . case_insensitive ( true ) . build ( ) . expect ( " " ) ; let result = re . replace_all ( s , format ! ( " " color Fg ( color Yellow ) color Fg ( color LightBlack ) ) . as_str ( ) , ) ; println ! ( " " result ) ; }
highlight query word in examples
and use &str instead
highlight query word in examples and use &str instead
s
&str
key
&str