24.14 Regular Expressions with the regex Library


Regular expressions are specially formatted strings that are used to find patterns in text. They can be used to validate data to ensure that it is in a particular format. For example, a zip code must consist of five digits, and a last name must start with a capital letter.

The regex library (from header <regex>) provides several classes and algorithms for recognizing and manipulating regular expressions. Class template basic_regex represents a regular expression. The algorithm regex_match returns true if a string matches the regular expression. With regex_match, the entire string must match the ...

Get C++ How to Program, Ninth Edition now with O’Reilly online learning.

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