Character Types
This lesson will explain how regex identifies the different types of text in C++.
The type of text determines the character type of the regular expression, the type of search result, and the type of action that will be taken with the search result.
This table shows four different combinations:
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.