diff options
Diffstat (limited to 'src/tiles.rs')
-rw-r--r-- | src/tiles.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tiles.rs b/src/tiles.rs new file mode 100644 index 0000000..1ed7320 --- /dev/null +++ b/src/tiles.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | use super::regex::Regex; | ||
2 | |||
3 | use std::str::FromStr; | ||
4 | |||
5 | pub fn parse_tile_link_ids(s: &str, php_file: &str) -> Vec<u32> { | ||
6 | let re = Regex::new(&format!(r#"(?is)<A href="{}\.php\?id=([0-9]+)"><IMG"#, php_file)).unwrap(); | ||
7 | |||
8 | re.captures_iter(s).map(|cap| u32::from_str(cap.at(1).unwrap()).unwrap()).collect() | ||
9 | } | ||