Standard Library classes

To perform matching or replacement you have to create a regular expression object. This is an object of the class basic_regex that has template parameters for the character type and a regular expression traits class. There are two typedefs for this class: regex for char and wregex for wide chars, which have traits described by the regex_traits and wregex_traits classes.

The traits class determines how the regex class parses the expression. For example, recall from previous text that you can use w for a word, d for a digit, and s for whitespace. The [[::]] syntax allows you to use a more descriptive name for the character class: alnum, digit, lower, and so on. And since these are text sequences that depend upon a character ...

Get Beginning C++ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.