Created
May 3, 2018 03:24
-
-
Save sylints/a989a9c2fa961f70acbc491317e45b2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate regex; | |
extern crate rss; | |
use std::fs::File; | |
use std::io::BufReader; | |
use rss::Channel; | |
use regex::Regex; | |
fn main() { | |
let file = File::open("data.xml").unwrap(); | |
let channel = Channel::read_from(BufReader::new(file)).unwrap(); | |
let re = Regex::new(r"\w+\s\d+\s\d+\s(.+)").unwrap(); | |
for item in channel.items() { | |
for cap in re.captures_iter(item.title().unwrap()) { | |
println!("{}", &cap[1]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment