Skip to content

Instantly share code, notes, and snippets.

@sylints
Created May 3, 2018 03:24
Show Gist options
  • Save sylints/a989a9c2fa961f70acbc491317e45b2a to your computer and use it in GitHub Desktop.
Save sylints/a989a9c2fa961f70acbc491317e45b2a to your computer and use it in GitHub Desktop.
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