Today I encountered strange bug in my application. I've tested it for like 2 hours and didn't find a solution. Maybe you can help me solving this problem. So here it is:
#include <iostream>
#include <regex>
#include <vector>
int main()
{
std::regex reg("rmvb|avi|rm|mp4|256");
std::vector<std::string> ext{"rmvb", "avi", "rm", "mp4", "256", "null"};
for (int i = 0; i < 6; i++)
{
std::cout << ext[i] << "\t" << std::boolalpha << std::regex_match(ext[i], reg) << std::endl;
}
return 0;
}
Output:
rmvb true
avi true
rm false
mp4 false
256 false
null false
It seems that pattern is discarded after the second element - no matter what order I choose (I tried to swap them, because I thought that digits can cause this bug - but they aren't). Now I have no idea what's going on.
I'm using gcc version 4.6.3 (Debian 4.6.3-1).