Take a found regular expression and convert it to proper match object.
(haystack: PyStrRef, captures: Captures)
| 288 | |
| 289 | /// Take a found regular expression and convert it to proper match object. |
| 290 | fn create_match(haystack: PyStrRef, captures: Captures) -> PyMatch { |
| 291 | let captures = captures |
| 292 | .iter() |
| 293 | .map(|opt| opt.map(|m| m.start()..m.end())) |
| 294 | .collect(); |
| 295 | PyMatch { haystack, captures } |
| 296 | } |
| 297 | |
| 298 | fn extract_flags(flags: OptionalArg<usize>) -> PyRegexFlags { |
| 299 | flags.map_or_else(Default::default, PyRegexFlags::from_int) |