C++0x’s <regex> header combines Perl’s regular expressions with C++’s templates and iterators. The result, like the rest of the STL, is insanely powerful but potentially overwhelming at first sight. It’s actually easy to use, and much easier than writing string processing code by hand. I demonstrate how to start using <regex> in Part 8 of my video lecture series introducing the Standard Template Library.
Previous parts:
Part 1 (sequence containers)
Part 2 (associative containers)
Part 3 (smart pointers)
Part 4 (Nurikabe solver) – see Wikipedia’s article and my updated source code
Part 5 (Nurikabe solver, continued)
Part 6 (algorithms and functors)
Part 7 (algorithms and functors, continued)
Attached to this blog post are the slides that I mentioned in the video, which contain an overview of the Perl/JavaScript/ECMAScript regular expression grammar used by C++, as well as many examples.
Stephan T. Lavavej
Visual C++ Libraries Developer
0 comments