fn escape_re<T: AsRef<str>>(input: T) -> String {
    input
        .as_ref()
        .chars()
        .map(|x| match x {
            '^' | '$' | '.' | '\\' | '|' | '[' | ']' | '(' | ')' | '{' | '}' | '?' | '*' | '+' => {
                format!("\\{}", x)
            }
            _ => x.to_string(),
        })
        .collect()
}
/**
 * Escape characters that can appear in a git-compatible regex
 */
Escape characters that can appear in a git-compatible regex
Escape characters that can appear in a git - compatible regex
fn escape_re<T: AsRef<str>>(input: T) -> String {
    input
        .as_ref()
        .chars()
        .map(|x| match x {
            '^' | '$' | '.' | '\\' | '|' | '[' | ']' | '(' | ')' | '{' | '}' | '?' | '*' | '+' => {
                format!("\\{}", x)
            }
            _ => x.to_string(),
        })
        .collect()
}
fn escape_re < T : AsRef < str > > ( input : T ) -> String { input . as_ref ( ) . chars ( ) . map ( | x | match x { '^' | '$' | '.' | '\\' | '|' | '[' | ']' | '(' | ')' | '{' | '}' | '?' | '*' | '+' => { format ! ( " \\ " x ) } _ => x . to_string ( ) , } ) . collect ( ) }
Escape characters that can appear in a git-compatible regex
Escape characters that can appear in a git - compatible regex
input
T
input
T