Matching strings using regular expressions

Let's do something useful! It's common that the user's input must be checked using some regular expression-specific pattern that provides a flexible means of match. The problem is that there are a lot of regex syntaxes; expressions written using one syntax are not handled well by the other syntax. Another problem is that long regexes are not easy to write.

So in this recipe, we'll write a program that may use different types of regular expression syntaxes and checks that the input strings match the specified regexes.

Getting ready

This recipe requires basic knowledge of STL. Knowledge of regular expression syntax can be helpful, but it is not really required.

Linking examples against the libboost_regex library ...

Get Boost C++ Application Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.