Showing content from https://cplusplus.com/reference/regex/basic_regex/ below:
class template
<regex>
std::basic_regex
template <class charT, class traits = regex_traits<charT> > class basic_regex;
Regular expression
A regular expression is an object defining a particular pattern to be matched against a sequence of characters using the tools of the standard regex library.
Such objects are essentially constructed from a sequence of characters that can include several wildcards and constraints to define the set of rules (the pattern) that make a sequence of characters qualify as a match. By default, regex patterns follow the ECMAScript syntax.
basic_regex object do not conduct the matches directly through any of its members. Instead, they are used as arguments for regex algorithms (regex_match, regex_search and regex_replace) and regex iterator adaptors (regex_iterator and regex_token_iterator) that perform these matches using the rules specified when constructing the basic_regex object.
Two instantiations of this basic class exist in the standard header <regex> for the most common cases:
1
2
typedef basic_regex<char> regex;
typedef basic_regex<wchar_t> wregex;
Template parameters
-
charT
-
The character type.
-
traits
-
The regex traits to be used by regex operations on this object.
This can either be an instantiation of the regex_traits class template or a custom class with the same members.
Template instantiations
-
regex
-
Regex (class)
-
wregex
-
Regex for wchar_t (class)
Member types The following aliases are member types of basic_regex. They are widely used as parameter and return types by member functions:
member type definition notes value_type The first template parameter (charT) The character type. traits_type The second template parameter (traits)<char> Regex traits (defaults to regex_traits). string_type traits::string_type String type (string for regex, wstring for wregex). flag_type regex_constants::syntax_option_type locale_type traits::locale_type locale for the standard regex_traits.
Member functions
-
(constructor)
-
Construct regex (public member function)
-
(destructor)
-
Destroy regex (public member function)
-
operator=
-
Assign regular expression (public member function)
Assignment
-
assign
-
Assign regular expression (public member function)
Const operations
-
mark_count
-
Return number of marked sub-expressions (public member function)
-
flags
-
Return syntax flags (public member function)
Locale
-
imbue
-
Imbue locale (public member function)
-
getloc
-
Get locale (public member function)
Swap
-
swap
-
Swap content (public member function)
Non-member functions
-
swap (basic_regex)
-
Exchanges the contents of two regex (function template)
Member constants These member constants are aliases of the homonym constants under the std::regex_constants namespace (see regex_constants for more details):
flag* effects on syntax Notes icase Case insensitive Regular expressions match without regard to case. nosubs No sub-expressions The match_results structure will not contain sub-expression matches. optimize Optimize matching Matching efficiency is preferred over efficiency constructing regex objects. collate Locale sensitiveness Character ranges, like "[a-b]", are affected by locale. ECMAScript ECMAScript grammar The regular expression follows one of these grammars.
One (and only one) of these six grammar flags needs to be set for the bitmask to have a valid value. basic Basic POSIX grammar extended Extended POSIX grammar awk Awk POSIX grammar grep Grep POSIX grammar egrep Egrep POSIX grammar
See also
-
regex
-
Regex (class)
-
wregex
-
Regex for wchar_t (class)
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4