Wrapper around POSIX extended regular expressions. More...
#include <OSspecific/regExp.H>
Wrapper around POSIX extended regular expressions.
Public Member Functions | |
regExp () | |
Construct null. | |
regExp (const char *, const bool ignoreCase=false) | |
Construct from character array, optionally ignoring case. | |
regExp (const std::string &, const bool ignoreCase=false) | |
Construct from std::string (or string), optionally ignoring case. | |
~regExp () | |
bool | empty () const |
Access. | |
bool | exists () const |
Does a precompiled expression exist? | |
int | ngroups () const |
Return the number of (groups) | |
void | set (const char *, const bool ignoreCase=false) const |
Editing. | |
void | set (const std::string &, const bool ignoreCase=false) const |
Compile pattern into a regular expression, optionally ignoring case. | |
bool | clear () const |
Release precompiled expression. | |
std::string::size_type | find (const std::string &str) const |
Searching. | |
bool | match (const std::string &) const |
Return true if it matches the entire string. | |
bool | match (const string &, List< string > &groups) const |
Return true if it matches and sets the sub-groups matched. | |
bool | search (const std::string &str) const |
Return true if the regex was found in within string. | |
void | operator= (const char *) |
Assign and compile pattern from a character array. | |
void | operator= (const std::string &) |
Assign and compile pattern from string. |
Static Public Member Functions | |
static bool | meta (char c) |
Is character a regular expression meta-character? |
regExp | ( | const char * | pattern, |
const bool | ignoreCase = false |
||
) |
regExp | ( | const std::string & | pattern, |
const bool | ignoreCase = false |
||
) |
|
inlinestatic |
|
inline |
|
inline |
void set | ( | const char * | pattern, |
const bool | ignoreCase = false |
||
) | const |
Editing.
Compile pattern into a regular expression, optionally ignoring case
Definition at line 68 of file regExp.C.
References clear(), Foam::exit(), Foam::FatalError, and FatalErrorIn.
void set | ( | const std::string & | pattern, |
const bool | ignoreCase = false |
||
) | const |
bool clear | ( | ) | const |
std::string::size_type find | ( | const std::string & | str | ) | const |
Searching.
Find position within string.
Returns the index where it begins or string::npos if not found
Definition at line 116 of file regExp.C.
Referenced by regExp::search().
bool match | ( | const std::string & | str | ) | const |
Return true if it matches the entire string.
The begin-of-line (^) and end-of-line ($) anchors are implicit
Definition at line 133 of file regExp.C.
Referenced by layerParameters::layerParameters().
Return true if it matches and sets the sub-groups matched.
The begin-of-line (^) and end-of-line ($) anchors are implicit
Definition at line 156 of file regExp.C.
References List< T >::clear(), and List< T >::setSize().
|
inline |
Return true if the regex was found in within string.
Definition at line 162 of file regExp.H.
References regExp::find().
void operator= | ( | const char * | pat | ) |
void operator= | ( | const std::string & | pat | ) |