One of the major new features added to the recently released C++11 is support for regular expressions. Sadly GCC doesn’t have a working regex implementation yet, but clang and Visual Studio do. If you’re looking for an introduction then the Solarian Programmer has a two part tutorial to get you going:

Validating the user input was always a problem in C++, especially when the user is supposed to enter a number. Each programmer was forced to write his own error checking functions for numerical input validation, basically it was no uniform syntax for checking the correctness of the user input. Enter C++11 and regular expression!

Start with part 1 and finish off with part 2.