mardi 5 novembre 2019

Regular Expression using C++

I want to create a Regular Expression which will only the input string to contain only [G|y|M|d|D|F|E|h|H|m|s|S|w|W|a|z|Z] so I come up with some code from below:

std::regex Reg = regex("[G|y|M|d|D|F|E|h|H|m|s|S|w|W|a|z|Z]");

My problem is that my regex still not correct because my input string can contain other characters with the characters in the above group such as:

std::string myInputString = Gx //correct

Which Gx has to be wrong

Aucun commentaire:

Enregistrer un commentaire