Q:

Regex matches only the first two of many possibilities in a matching group

I've noticed that the c++11 regex is only "considering" the first two choices in a matching group that contains 4 choices. The regex is correct according to regex101 and if I change the order of the elements in the matching group, the first two always get recognized but not the following ones.
The code is pretty straightforward, is there something that I missed ?
#include <iostream>
#include <regex>

using namespace std;

int main()
{
    std::regex staticFilesMatcher(".*\\.(ico|jpg|png|gif)", std::regex_constants::ECMAScript | std::regex_constants::icase);
    if (std::regex_match("test.ico", staticFilesMatcher))
        std::cout << "ICO file recognized" << std::endl;
    if (std::regex_match("test.jpg", staticFilesMatcher))
        std::cout << "JPG file recognized" << std::endl;
    if (std::regex_match("test.png", staticFilesMatcher))
        std::cout << "PNG file recognized" << std::endl;
    if (std::regex_match("test.gif", staticFilesMatcher))
        std::cout << "GIF file recognized" << std::endl;
    return 0;
}

Weirdly, the output is 
ICO file recognized
JPG file recognized

Process returned 0 (0x0)   execution time : 0.002 s
Press ENTER to continue.

Thanks for any help that could get me to find the solution to this.

A:

According to your comment, you are using GCC 4.8.2. But regex was not implemented until GCC 4.9. If you can't upgrade your compiler, you'll have to use boost.regex.

