Given this code. I expect to get this output from the corresponding input:
Input: FOO Output: Match Input: FOOBAR, Output: Match Input: BAR, Output: No Match
But why it gives "No Match" for input FOOBAR?
You - possibly - have the regex and the string the wrong way around. You are trying to match the regex "FOO" against the string "FOOBAR" and regex_match will only succeed if the *whole of the string matches the regex*, with the flag match_partial set then it will also return true if *the whole of the string matches a prefix of the regular expression*. If you really wanted to match all of the regex against a prefix of the string (a more common situation) then use regex_search with match_continuous set. And of course, if you want to find an occurance of a regex somewhere within the string then set no flags. HTH, John.