|
|
|
@ -27,11 +27,14 @@
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
void begin(string needle, istream &in)
|
|
|
|
|
int begin(string needle, istream &in)
|
|
|
|
|
{
|
|
|
|
|
string input; //This is where we keep our input, line by line
|
|
|
|
|
boost::xpressive::sregex regex = boost::xpressive::sregex::compile( needle, boost::xpressive::regex_constants::icase ); //this is what we search for
|
|
|
|
|
|
|
|
|
|
if( !in.good() ) { //Check if steam is ok
|
|
|
|
|
cerr << "Could not open file \n";
|
|
|
|
|
return 1; //if not return 1
|
|
|
|
|
} else { //go ahead
|
|
|
|
|
while(in) { //loop through input line by line
|
|
|
|
|
getline(in, input);
|
|
|
|
|
if ( boost::xpressive::regex_search(input, regex) ) { //if we find a match
|
|
|
|
@ -39,10 +42,11 @@ void begin(string needle, istream &in)
|
|
|
|
|
while(in) { //and print what remains as well
|
|
|
|
|
getline(in,input);
|
|
|
|
|
cout << input << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} //end of inner while
|
|
|
|
|
} //end of if
|
|
|
|
|
} //end of outer while
|
|
|
|
|
} //end of else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|