0

I want to match this string like this:Micron_5200_MTFDDAK3T8TDC

I use a regular expression:(Micron_5200_)?MTFDDAK(480|960|1T9|3T8|7T6)TD(C|D|N)

Then I try it with C++:

string str="Micron_5200_MTFDDAK3T8TDC";
string pattern="(Micron_5200_)?MTFDDAK(480|960|1T9|3T8|7T6)TD(C|D|N)";
regex reg(pattern,regex_constants::extended);
cout << regex_match(str, reg) << endl;

I compile it on centos7.6 x64 using GCC 4.8.5 with -std=c++11 flag. But I always get No matches found. What am I doing wrong?

0 Answers0