pub fn group_by_regex(&mut self, line: String, regex: &Regex) {
        let key = match match_regex(&line, &regex) {
            Some(s) => s,
            None => "",
        }
        .to_string();

        self.add(key, line);
    }
/// Groups a String according to the provided Regex and adds it to the collection.
///
/// See `match_regex` for details on how the key is determined.
///
/// # Examples
///
/// ```
/// # use groupby::grouped_collection::*;
/// # use regex::Regex;
/// let mut coll = GroupedCollection::new();
/// let expected = vec!["Nineteen99".to_string()];
/// let regex = Regex::new(r"\d+").unwrap();
/// coll.group_by_regex(expected[0].clone(), &regex);
/// assert_eq!(Some(&expected), coll.get(&"99".to_string()));
/// ```
Groups a String according to the provided Regex and adds it to the collection.
See `match_regex` for details on how the key is determined.
Groups a String according to the provided Regex and adds it to the collection . See ` match_regex ` for details on how the key is determined .
pub fn group_by_regex(&mut self, line: String, regex: &Regex) {
        let key = match match_regex(&line, &regex) {
            Some(s) => s,
            None => "",
        }
        .to_string();
        self.add(key, line);
    }
pub fn group_by_regex ( & mut self , line : String , regex : & Regex ) { let key = match match_regex ( & line , & regex ) { Some ( s ) => s , None => " " , } . to_string ( ) ; self . add ( key , line ) ; }
Groups a String according to the provided Regex and adds it to the collection.
Groups a String according to the provided Regex and adds it to the collection .
&mut self
line
String
regex
&Regex
&mut self
line
String
regex
&Regex
examples
None
use groupby::grouped_collection::*;
None
use regex::regex;
let mut coll = GroupedCollection::new();
let expected = vec!["Nineteen99".to_string()];
let regex = Regex::new(r"\d+").unwrap();
coll.group_by_regex(expected[0].clone(), &regex);
assert_eq!(Some(&expected), coll.get(&"99".to_string()));
```
let mut coll = GroupedCollection :: new () ; let expected = vec! [ " Nineteen99 " . to_string () ] ; let regex = Regex :: new ( r " \ d + " ) . unwrap () ; coll . group_by_regex ( expected [ 0 ] . clone () &regex ) ; assert_eq! ( Some ( &expected ) coll . get ( & " 99 " . to_string () )) ; ` ` `