Modern C++ idoms and recipes

meshell
58K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Regular expressions

C++11 provides support for regular expressions within the standard library in the header regex through a set of classes, iterators, and algorithms. Regular expressions are used to perform pattern matching within strings.

Example

The following example checks if an input string represents a valid email address.

DIY

The example above verified a string by checking for a regex match. However the regex library allows also to search for matches and replace certain patterns. Try to solve the next exercise by using the right classes and algorithms from <regex> .

Implement the function according the documentation
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content