24.14 Regular Expressions with the regex Library
Regular expressions are specially formatted string
s 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 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.