18 Apr
2019
18 Apr
'19
1:42 a.m.
On 17/04/2019 21:39, Simon Giddings wrote:
std::string strInput = "&9-A02FEfoo"; sregex re;
re = bos >> as_xpr("&9-A02FE") >> before("foo"); if(regex_match(strInput, sm, re)) { strResult = "matched : " + sm[0].str(); }
regex_match requires matching the entire string. "before" is a lookahead assertion, which means it doesn't actually consume the "foo" in the input, so the match fails. Use regex_search instead if you want to find partial matches.