Using regular expressions in C++11

Posted by Peter J. Jones on

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.

About the Author

Peter J. Jones has been a professional software engineer for over 20 years and is deeply passionate about helping programmers improve the skills of their craft. He is the author of Effective Ruby: 48 Specific Ways to Write Better Ruby. Peter can be reached through our contact page or his twitter account.