pub fn insert_captures(&mut self, re: &Regex, text: &'a str) -> usize {
        // get the captures
        let caps = re.captures(text).unwrap();

        // insert number of captures
        let nbcaps = caps.len();

        // now loop and get text corresponding to either name or position
        for (i, cg_name) in re.capture_names().enumerate() {
            match cg_name {
                None => {
                    if let Some(m) = caps.get(i) {
                        // variable will be: CLF_CG_2 (example)
                        if i > CAPTURE_GROUPS_LENGTH - 1 {
                            panic!("your're only limited to 30 capture groups !")
                        }
                        self.inner
                            //.insert(prefix_var!("CG_", i), VarType::from(m.as_str()));
                            .insert(Cow::from(CAPTURE_GROUPS[i]), VarType::from(m.as_str()));
                    }
                }
                Some(cap_name) => {
                    if let Some(m) = caps.name(cap_name) {
                        // variable will be: CLF_FOO (example)
                        self.inner
                            .insert(prefix_var!("CG_", cap_name), VarType::from(m.as_str()));
                    }
                }
            }
        }

        nbcaps
    }
/// Add variables taken from the capture group names or ids.
Add variables taken from the capture group names or ids.
Add variables taken from the capture group names or ids .
pub fn insert_captures(&mut self, re: &Regex, text: &'a str) -> usize {
        // get the captures
        let caps = re.captures(text).unwrap();
        // insert number of captures
        let nbcaps = caps.len();
        // now loop and get text corresponding to either name or position
        for (i, cg_name) in re.capture_names().enumerate() {
            match cg_name {
                None => {
                    if let Some(m) = caps.get(i) {
                        // variable will be: CLF_CG_2 (example)
                        if i > CAPTURE_GROUPS_LENGTH - 1 {
                            panic!("your're only limited to 30 capture groups !")
                        }
                        self.inner
                            //.insert(prefix_var!("CG_", i), VarType::from(m.as_str()));
                            .insert(Cow::from(CAPTURE_GROUPS[i]), VarType::from(m.as_str()));
                    }
                }
                Some(cap_name) => {
                    if let Some(m) = caps.name(cap_name) {
                        // variable will be: CLF_FOO (example)
                        self.inner
                            .insert(prefix_var!("CG_", cap_name), VarType::from(m.as_str()));
                    }
                }
            }
        }
        nbcaps
    }
pub fn insert_captures ( & mut self , re : & Regex , text : & ' a str ) -> usize { // get the captures let caps = re . captures ( text ) . unwrap ( ) ; // insert number of captures let nbcaps = caps . len ( ) ; // now loop and get text corresponding to either name or position for ( i , cg_name ) in re . capture_names ( ) . enumerate ( ) { match cg_name { None => { if let Some ( m ) = caps . get ( i ) { // variable will be: CLF_CG_2 (example) if i > CAPTURE_GROUPS_LENGTH - 1 { panic ! ( " " ) } self . inner //.insert(prefix_var!("CG_", i), VarType::from(m.as_str())); . insert ( Cow :: from ( CAPTURE_GROUPS [ i ] ) , VarType :: from ( m . as_str ( ) ) ) ; } } Some ( cap_name ) => { if let Some ( m ) = caps . name ( cap_name ) { // variable will be: CLF_FOO (example) self . inner . insert ( prefix_var ! ( " " cap_name ) , VarType :: from ( m . as_str ( ) ) ) ; } } } } nbcaps }
Add variables taken from the capture group names or ids.
Add variables taken from the capture group names or ids .
&mut self
re
&Regex
text
&'a str
&mut self
re
&Regex
text
&'a str