Character Types
This lesson will explain how regex identifies the different types of text in C++.
The type of the text determines the character type of the regular expression, the type of search result, and the type of action with the search result.
The following table shows the four different combinations of type of text, regular expression, search result, and action:
Text type | Regular expression type | Result type | Action type |
---|---|---|---|
const char* |
std::regex |
std::smatch |
std::regex_search |
std::string |
std::regex |
std::smatch |
std::regex_search |
const wchar_t* |
std::wregex |
std::wcmatch |
std::wregex_search |
std::wstring |
std::wregex |
std::wsmatch |
std::wregex_search |
Combinations of type of text, regular expression, search result and action
The program shown in the Search section of this chapter provides the four combinations in detail.
Get hands-on with 1400+ tech skills courses.