I am using boost :: xpressive to parse in a text file. I want to see only if the line starts with the character '#' (once).
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 always get “match not found!” Even when the lines begin with C #. Can anyone help me here?
By the way, can someone help me write a rex1 instruction using boost :: xpressive 'bos'?
Thank! Aisha
source
share