Skip to content

Instantly share code, notes, and snippets.

@sourabh86
Created October 4, 2013 14:30
Show Gist options
  • Save sourabh86/6826862 to your computer and use it in GitHub Desktop.
Save sourabh86/6826862 to your computer and use it in GitHub Desktop.
main cpp file for Boost regex example
#include <boost/regex.hpp>
#include <iostream>
#include <string>
int main()
{
std::string line;
boost::regex pat( "^Subject: (Re: |Fw: )*(.*)" );
while (std::cin)
{
std::getline(std::cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
std::cout << matches[2] << std::endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment