This is weird, I have the following std::regex (rx)
\{\{alternate form of\s*\|(?:\d=)?(.*?)([\|#][^\|}]*)*\}\}
which regex_search returns true for when given this string (str)
{{alternate form of|abate|nodot=1}} {{qualifier|abbot}}.
but when I call regex_match(str, m, rx), the match set m is empty. Using JavaScript mode in RegexBuddy (which seems to be the closest in behaviour I can find to VS2012’s regex support) the matches are correctly found. Anyone got any ideas? The regex looks overspecified because some other strings need extra pieces matched…
regex_searchmatches any part of the target string.regex_matchmatches the entire string. The regular expression matches the first part of the target string, “{{alternate form of|abate|nodot=1}}”. That’s whatregex_searchfinds. That’s not the entire string, which is whyregex_matchdoesn’t find a match.