Description

Include the TR1 header <regex> to define a template class to parse regular expressions and several template classes and functions to search text for matches to a regular expression object.

Note: To enable this header file, you must define the macro __IBMCPP_TR1__ and use the TARGET compiler option to specify a valid release level. Valid release levels for TR1 support are zOSV1R12 or later. For example, you can specify the TARGET option as follows: TARGET(zOSV1R12).

Any release prior to zOSV1R12 is invalid for the use of TR1. If TR1 code is used in an application to be compiled on an earlier platform, the compiler will issue the #error directive.

To create a regular expression object use the template class basic_regex or one of its specializations, regex and wregex, along with the syntax flags of type syntax_option_type.

To search text for matches to a regular expression object use the template functions regex_match and regex_search, along with the match flags of type match_flag_type. These functions return their results using the template class match_results and its specializations, cmatch, wcmatch, smatch, and wsmatch, along with the template class sub_match and its specializations, csub_match, wcsub_match, ssub_match, and wssub_match.

To replace text that matches a regular expression object use the template function regex_replace, along with the match flags of type match_flag_type.

To iterate through multiple matches of a regular expression object use the template classes regex_iterator and regex_token_iterator or one of their specializations, cregex_iterator, sregex_iterator, wcregex_iterator, wsregex_iterator, cregex_token_iterator, sregex_token_iterator, wcregex_token_iterator, and wsregex_token_iterator, along with the match flags of type match_flag_type.

To modify some of the details of the grammar of regular expressions write a class that implements the regular expression traits.