Regular Expression Objects
Objects of type regular expression are instances of the class template template <class charT, class traits= regex_traits
<charT>> class basic_regex
parametrized by their character type and traits class. The traits class defines the interpretation of the properties of the regular grammar. There are two type synonyms in C++:
typedef
basic_regex
<
char
>
regex
;
typedef
basic_regex
<
wchar_t
>
wregex
;
You can further customise the object of type regular expression. Therefore you can specify the used grammar or adapt the syntax. As said before, C++ supports the basic, extended, awk, grep and egrep grammars. A regular expression qualified by the std::regex_constants::icase
flag is case insensitive. If you want to adopt the syntax, you have to specify the grammar explicitly.
// regexGrammar.cpp
...
#include
<regex>
...
using
std
::
regex_constants
::
ECMAScript
;
using
std
::
regex_constants
::
icase
;
std
::
string
theQuestion...