Skip to content

Instantly share code, notes, and snippets.

@Cvetomird91
Last active April 3, 2018 15:47
Show Gist options
  • Save Cvetomird91/d2b5612e051e7ef5609d04d6c0c75914 to your computer and use it in GitHub Desktop.
Save Cvetomird91/d2b5612e051e7ef5609d04d6c0c75914 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <iterator>
#include <vector>
#include <string>
#include <fstream>
#include <set>
#include <map>
#include <boost/regex.hpp>
//std::string regex_str = R"(^Matches found.*?(?= \())";
std::string regex_str = "diabetes.*?\\(octave #(\\d{1,})?\\)";
const boost::regex frequency_line(regex_str, boost::regex_constants::icase);
int main(int argc, char* argv[]) {
// std::ifstream *file = new std::ifstream("frequencies");
std::string str = "";
boost::smatch match;
//for (std::string str; std::getline(*file, str);) {
if (boost::regex_search(str, match, frequency_line)) {
std::cout << str << std::endl;
std::cout << match[0] << std::endl;
std::cout << match[1] << std::endl;
//std::cout << match[2] << std::endl;
//std::cout << match[3] << std::endl;
}
//}
//delete file;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment