Wrapper around POSIX extended regular expressions. More...
Public Types | |
typedef SubStrings< std::string > | results_type |
Type for matches - similar to std::smatch. More... | |
Public Member Functions | |
regExpPosix () | |
Construct null. More... | |
regExpPosix (const regExpPosix &)=delete | |
Copy construct - disallowed. More... | |
regExpPosix (regExpPosix &&rgx) | |
Move construct. More... | |
regExpPosix (const char *pattern) | |
Construct from character array. More... | |
regExpPosix (const std::string &pattern) | |
Construct from string. More... | |
regExpPosix (const char *pattern, bool ignoreCase) | |
Construct from character array, optionally ignore case. More... | |
regExpPosix (const std::string &pattern, bool ignoreCase) | |
Construct from string, optionally ignore case. More... | |
~regExpPosix () | |
Destructor. More... | |
bool | empty () const noexcept |
Return true if a precompiled expression does not exist. More... | |
bool | exists () const noexcept |
Return true if a precompiled expression exists. More... | |
unsigned | ngroups () const |
The number of capture groups for a non-empty expression. More... | |
bool | clear () |
Clear expression. More... | |
void | swap (regExpPosix &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 regExpPosix &)=delete |
Copy assignment - disallowed. More... | |
void | operator= (regExpPosix &&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 (char c) |
Test if character appears to be a regular expression meta-character. More... | |
Static Public Attributes | |
static int | grammar |
Grammar (unused) - for compatibility with Foam::regExpCxx. More... | |
Wrapper around POSIX extended regular expressions.
The PCRE '(?i)' extension is provided to compile the regular expression as being case-insensitive.
Perl
and sed
regular expressions.Definition at line 75 of file regExpPosix.H.
typedef SubStrings<std::string> results_type |
Type for matches - similar to std::smatch.
Definition at line 87 of file regExpPosix.H.
|
inline |
Construct null.
Definition at line 46 of file regExpPosixI.H.
|
delete |
Copy construct - disallowed.
|
inline |
Move construct.
Definition at line 84 of file regExpPosixI.H.
|
inlineexplicit |
Construct from character array.
Definition at line 52 of file regExpPosixI.H.
References regExpPosix::set().
|
inlineexplicit |
Construct from string.
Definition at line 60 of file regExpPosixI.H.
References regExpPosix::set().
|
inline |
Construct from character array, optionally ignore case.
Definition at line 68 of file regExpPosixI.H.
References regExpPosix::set().
|
inline |
Construct from string, optionally ignore case.
Definition at line 76 of file regExpPosixI.H.
References regExpPosix::set().
|
inline |
Destructor.
Definition at line 94 of file regExpPosixI.H.
References clear().
|
inlinestatic |
Test if character appears to be a regular expression meta-character.
Definition at line 32 of file regExpPosixI.H.
References Foam::constant::universal::c.
|
inlinenoexcept |
Return true if a precompiled expression does not exist.
Definition at line 102 of file regExpPosixI.H.
|
inlinenoexcept |
Return true if a precompiled expression exists.
Definition at line 108 of file regExpPosixI.H.
|
inline |
The number of capture groups for a non-empty expression.
Definition at line 114 of file regExpPosixI.H.
bool clear | ( | ) |
Clear expression.
Definition at line 54 of file regExpPosix.C.
|
inline |
Swap contents.
Definition at line 126 of file regExpPosixI.H.
Compile pattern into a regular expression, optionally ignore case.
Definition at line 69 of file regExpPosix.C.
References clear(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
Referenced by regExpPosix::regExpPosix().
Compile pattern into a regular expression, optionally ignore case.
Definition at line 120 of file regExpPosix.C.
References Foam::BitOps::set().
std::string::size_type find | ( | const std::string & | text | ) | const |
Find position within the text.
Definition at line 126 of file regExpPosix.C.
bool match | ( | const std::string & | text | ) | const |
True if the regex matches the entire text.
The begin-of-line (^) and end-of-line ($) anchors are implicit
Definition at line 143 of file regExpPosix.C.
bool match | ( | const std::string & | text, |
results_type & | matches | ||
) | const |
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
|
inline |
Return true if the regex was found within the text.
Definition at line 120 of file regExpPosixI.H.
References Foam::ListOps::find().
|
inline |
Perform match on text.
Definition at line 138 of file regExpPosixI.H.
References Foam::stringOps::match().
|
delete |
Copy assignment - disallowed.
|
inline |
Move assignment.
Definition at line 144 of file regExpPosixI.H.
References clear().
|
inline |
Assign and compile pattern from a character array.
Matching is case sensitive.
Definition at line 151 of file regExpPosixI.H.
References Foam::BitOps::set().
|
inline |
Assign and compile pattern from string.
Matching is case sensitive.
Definition at line 157 of file regExpPosixI.H.
References Foam::BitOps::set().
|
static |
Grammar (unused) - for compatibility with Foam::regExpCxx.
Definition at line 93 of file regExpPosix.H.