lundi 28 novembre 2016

C++11 Regex not matching

I am trying to read a file and get data to implement an employee management system. I tried to validate the readings from the file using c++11's regex library.

this is my regex:

regex emp("[E][M][[:digit]]+");

then I used an if condition to match the regex, as follows:

if(regex_match(line, matcher, emp_regex)) // line is the  I read from the file.
{
  ...
} 

But the program doesn't go inside the if block, even though the line was read correctly and the line contains string EM23

What I did wrong here ?

Aucun commentaire:

Enregistrer un commentaire