I am using boost::xpressive to parse through my text file. I want to see if only when the line begins with a '#' (one of more times).
I am using the following code
std::string str1 = "## this could be my line";
sregex rex1 = sregex::compile("^#+");
smatch result1;
if(regex_match(str1,result1,rex1){
std::cout << result1[0] << '\n';
}else{
std::cout << "match not found!\n";
}
But I am always getting "match not found!", even when the lines begin with #. Can anyone help me here?
Incidently, can anyone also help me in writing the rex1 statement using the boost::xpressive 'bos'?
Thanks! Ayesha