Wrapper around C++11 regular expressions. More...
Public Types | |
typedef std::smatch | results_type |
Type for matches. More... | |
Public Member Functions | |
regExpCxx () | |
Construct null. More... | |
regExpCxx (const regExpCxx &rgx) | |
Copy construct. More... | |
regExpCxx (regExpCxx &&rgx) | |
Move construct. More... | |
regExpCxx (const char *pattern) | |
Construct from character array. More... | |
regExpCxx (const std::string &pattern) | |
Construct from string. More... | |
regExpCxx (const char *pattern, bool ignoreCase) | |
Construct from character array, optionally ignore case. More... | |
regExpCxx (const std::string &pattern, bool ignoreCase) | |
Construct from string, optionally ignore case. More... | |
~regExpCxx ()=default | |
Destructor. More... | |
bool | empty () const noexcept |
Return true if expression is empty. More... | |
bool | exists () const noexcept |
Return true if expression is non-empty. More... | |
unsigned | ngroups () const |
The number of capture groups for a non-empty expression. More... | |
bool | nocase () const |
bool | clear () |
Clear expression. More... | |
void | swap (regExpCxx &rgx) |
Swap contents. More... | |
bool | set (const char *pattern, bool ignoreCase=false) |
Compile pattern into a regular expression, optionally ignore case. More... | |
bool | set (const std::string &pattern, bool ignoreCase=false) |
Compile pattern into a regular expression, optionally ignore case. More... | |
std::string::size_type | find (const std::string &text) const |
Find position within the text. More... | |
bool | match (const std::string &text) const |
True if the regex matches the entire text. More... | |
bool | match (const std::string &text, results_type &matches) const |
True if the regex matches the text, set the matches. More... | |
bool | search (const std::string &text) const |
Return true if the regex was found within the text. More... | |
bool | operator() (const std::string &text) const |
Perform match on text. More... | |
void | operator= (const regExpCxx &rgx) |
Copy assignment. More... | |
void | operator= (regExpCxx &&rgx) |
Move assignment. More... | |
void | operator= (const char *pattern) |
Assign and compile pattern from a character array. More... | |
void | operator= (const std::string &pattern) |
Assign and compile pattern from string. More... | |
Static Public Member Functions | |
static bool | meta (const char c) |
Test if character appears to be a regular expression meta-character. More... | |
Static Public Attributes | |
static int | grammar |
The default grammar (extended | ECMAScript). More... | |
Wrapper around C++11 regular expressions.
Using either POSIX extended regular expressions or modified ECMAScript regular expression grammar
Since ECMAScript grammar may not work correctly on all installations, the current default is to use extended regular expressions.
The JAVA/PCRE '(?i)' extension is supported as a prefix to compile the regular expression as being case-insensitive.
Definition at line 72 of file regExpCxx.H.
typedef std::smatch results_type |
Type for matches.
Definition at line 93 of file regExpCxx.H.
|
inline |
Construct null.
Definition at line 56 of file regExpCxxI.H.
Copy construct.
Definition at line 63 of file regExpCxxI.H.
Move construct.
Definition at line 70 of file regExpCxxI.H.
|
inlineexplicit |
Construct from character array.
Definition at line 79 of file regExpCxxI.H.
References regExpCxx::set().
|
inlineexplicit |
Construct from string.
Definition at line 88 of file regExpCxxI.H.
References regExpCxx::set().
Construct from character array, optionally ignore case.
Definition at line 97 of file regExpCxxI.H.
References regExpCxx::set().
Construct from string, optionally ignore case.
Definition at line 106 of file regExpCxxI.H.
References regExpCxx::set().
|
default |
Destructor.
|
inlinestatic |
Test if character appears to be a regular expression meta-character.
Definition at line 42 of file regExpCxxI.H.
References Foam::constant::universal::c.
Referenced by wordRe::meta().
|
inlinenoexcept |
Return true if expression is empty.
Definition at line 117 of file regExpCxxI.H.
|
inlinenoexcept |
Return true if expression is non-empty.
Definition at line 123 of file regExpCxxI.H.
|
inline |
The number of capture groups for a non-empty expression.
Definition at line 129 of file regExpCxxI.H.
|
inline |
Definition at line 135 of file regExpCxxI.H.
|
inline |
Clear expression.
Definition at line 141 of file regExpCxxI.H.
Referenced by regExpCxx::set().
|
inline |
Swap contents.
Definition at line 155 of file regExpCxxI.H.
Compile pattern into a regular expression, optionally ignore case.
Definition at line 111 of file regExpCxx.C.
References regExpCxx::clear(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
Referenced by regExpCxx::regExpCxx().
Compile pattern into a regular expression, optionally ignore case.
Definition at line 160 of file regExpCxx.C.
References clear(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
|
inline |
Find position within the text.
Definition at line 167 of file regExpCxxI.H.
|
inline |
True if the regex matches the entire text.
The begin-of-line (^) and end-of-line ($) anchors are implicit
Definition at line 185 of file regExpCxxI.H.
Referenced by keyType::match(), and STARCDsurfaceFormatCore::readInpCellTable().
|
inline |
True if the regex matches the text, set the matches.
The first group starts at index 1 (0 is the entire match). The begin-of-line (^) and end-of-line ($) anchors are implicit
Definition at line 192 of file regExpCxxI.H.
|
inline |
Return true if the regex was found within the text.
Definition at line 179 of file regExpCxxI.H.
|
inline |
Perform match on text.
Definition at line 203 of file regExpCxxI.H.
References Foam::stringOps::match().
|
inline |
Copy assignment.
Definition at line 209 of file regExpCxxI.H.
|
inline |
Move assignment.
Definition at line 216 of file regExpCxxI.H.
References clear().
|
inline |
Assign and compile pattern from a character array.
Matching is case sensitive.
Definition at line 223 of file regExpCxxI.H.
|
inline |
Assign and compile pattern from string.
Matching is case sensitive.
Definition at line 229 of file regExpCxxI.H.
|
static |
The default grammar (extended | ECMAScript).
Definition at line 99 of file regExpCxx.H.