Wrapper around POSIX extended regular expressions. More...
Public Member Functions | |
| regExp () | |
| Construct null. More... | |
| regExp (const char *, const bool ignoreCase=false) | |
| Construct from character array, optionally ignoring case. More... | |
| regExp (const std::string &, const bool ignoreCase=false) | |
| Construct from std::string (or string), optionally ignoring case. More... | |
| regExp (const regExp &)=delete | |
| Disallow default bitwise copy construction. More... | |
| ~regExp () | |
| Destructor. More... | |
| bool | empty () const |
| Return true if a precompiled expression does not exist. More... | |
| bool | exists () const |
| Does a precompiled expression exist? More... | |
| int | ngroups () const |
| Return the number of (groups) More... | |
| void | set (const char *, const bool ignoreCase=false) const |
| Compile pattern into a regular expression,. More... | |
| void | set (const std::string &, const bool ignoreCase=false) const |
| Compile pattern into a regular expression,. More... | |
| bool | clear () const |
| Release precompiled expression. More... | |
| std::string::size_type | find (const std::string &str) const |
| Find position within string. More... | |
| bool | match (const std::string &) const |
| Return true if it matches the entire string. More... | |
| bool | match (const std::string &, List< std::string > &groups) const |
| Return true if it matches and sets the sub-groups matched. More... | |
| bool | match (const std::string &, List< string > &groups) const |
| Return true if it matches and sets the sub-groups matched. More... | |
| bool | search (const std::string &str) const |
| Return true if the regex was found within string. More... | |
| void | operator= (const regExp &)=delete |
| Disallow default bitwise assignment. More... | |
| void | operator= (const char *) |
| Assign and compile pattern from a character array. More... | |
| void | operator= (const std::string &) |
| Assign and compile pattern from string. More... | |
Static Public Member Functions | |
| static bool | meta (char c) |
| Is character a regular expression meta-character? More... | |
Wrapper around POSIX extended regular expressions.
The PCRE '(?i)' extension is provided to compile the regular expression as being case-insensitive.
| regExp | ( | const char * | pattern, |
| const bool | ignoreCase = false |
||
| ) |
Construct from character array, optionally ignoring case.
Definition at line 90 of file regExp.C.
References regExp::set().

| regExp | ( | const std::string & | pattern, |
| const bool | ignoreCase = false |
||
| ) |
Construct from std::string (or string), optionally ignoring case.
Definition at line 98 of file regExp.C.
References regExp::set().

| ~regExp | ( | ) |
|
inlinestatic |
Is character a regular expression meta-character?
any character: '.'
quantifiers: '*', '+', '?'
grouping: '(', '|', ')'
range: '[', ']'
Don't bother checking for '{digit}' bounds
Definition at line 92 of file regExp.H.
Referenced by wordRe::meta().

|
inline |
|
inline |
| void set | ( | const char * | pattern, |
| const bool | ignoreCase = false |
||
| ) | const |
Compile pattern into a regular expression,.
optionally ignoring case
Definition at line 116 of file regExp.C.
References clear(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
Referenced by regExp::regExp().


| void set | ( | const std::string & | pattern, |
| const bool | ignoreCase = false |
||
| ) | const |
| bool clear | ( | ) | const |
| std::string::size_type find | ( | const std::string & | str | ) | const |
Find position within string.
Returns the index where it begins or string::npos if not found
Definition at line 184 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 201 of file regExp.C.
Referenced by keyType::match(), and STARCDsurfaceFormatCore::readInpCellTable().

| bool match | ( | const std::string & | str, |
| List< std::string > & | groups | ||
| ) | const |
|
inline |
Return true if the regex was found within string.
Definition at line 180 of file regExp.H.
References regExp::find().

|
delete |
Disallow default bitwise assignment.
| void operator= | ( | const char * | pat | ) |
| void operator= | ( | const std::string & | pat | ) |