| 166 | } |
| 167 | |
| 168 | fn do_match(pattern: &PyPattern, search_text: PyStrRef) -> Option<PyMatch> { |
| 169 | // I really wish there was a better way to do this; I don't think there is |
| 170 | let mut regex_text = r"\A".to_owned(); |
| 171 | regex_text.push_str(pattern.regex.as_str()); |
| 172 | let regex = Regex::new(®ex_text).unwrap(); |
| 173 | regex |
| 174 | .captures(search_text.as_bytes()) |
| 175 | .map(|captures| create_match(search_text.clone(), captures)) |
| 176 | } |
| 177 | |
| 178 | fn do_search(regex: &PyPattern, search_text: PyStrRef) -> Option<PyMatch> { |
| 179 | regex |