
2 Oct
2008
2 Oct
'08
1:32 p.m.
Hello everyone Why does the following regex not match? boost::regex expected("foo"); BOOST_CHECK(boost::regex_match("foo bar", expected)); Is there a flag I should set so that this regex matches? In perl, there would be a match in this case. if ("foo bar" =~ /foo/) { ... } Thanks for your hints. James

2 Oct
2 Oct
1:36 p.m.
Jean-Pierre Bergamin wrote:
Hello everyone
Why does the following regex not match?
boost::regex expected("foo"); BOOST_CHECK(boost::regex_match("foo bar", expected));
Is there a flag I should set so that this regex matches? In perl, there would be a match in this case. if ("foo bar" =~ /foo/) { ... }
Try using boost::regex_search instead of regex_match. Regex_match requires that the regex must match the *entire* string.
6044
Age (days ago)
6044
Last active (days ago)
1 comments
2 participants
participants (2)
-
Andrew Holden
-
Jean-Pierre Bergamin