regExp Class Reference
Wrapper around
POSIX extended regular expressions.
More...
List of all members.
|
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?
|
Detailed Description
Wrapper around
POSIX extended regular expressions.
- See also:
- The manpage regex(7) for more information about POSIX regular expressions. These differ somewhat from
Perl and sed regular expressions.
- Source files
-
Definition at line 53 of file regExp.H.
Constructor & Destructor Documentation
Construct null.
Definition at line 28 of file regExp.C.
| regExp |
( |
const char * |
pattern, |
|
|
const bool |
ignoreCase = false | |
|
) |
| | |
Construct from character array, optionally ignoring case.
Definition at line 34 of file regExp.C.
| regExp |
( |
const std::string & |
pattern, |
|
|
const bool |
ignoreCase = false | |
|
) |
| | |
Construct from std::string (or string), optionally ignoring case.
Definition at line 42 of file regExp.C.
Member Function Documentation
| static bool meta |
( |
char |
c |
) |
[inline, static] |
Is character a regular expression meta-character?
any character: '.'
quantifiers: '*', '+', '?'
grouping: '(', '|', ')'
range: '[', ']'
Don't bother checking for '{digit}' bounds
Definition at line 79 of file regExp.H.
| bool empty |
( |
|
) |
const [inline] |
Access.
Return true if a precompiled expression does not exist
Definition at line 112 of file regExp.H.
| bool exists |
( |
|
) |
const [inline] |
| int ngroups |
( |
|
) |
const [inline] |
Return the number of (groups).
Definition at line 124 of file regExp.H.
| void set |
( |
const char * |
pattern, |
|
|
const bool |
ignoreCase = false | |
|
) |
| | const |
Editing.
Compile pattern into a regular expression, optionally ignoring case
Definition at line 60 of file regExp.C.
References regExp::clear().
| void set |
( |
const std::string & |
pattern, |
|
|
const bool |
ignoreCase = false | |
|
) |
| | const |
Compile pattern into a regular expression, optionally ignoring case.
Definition at line 87 of file regExp.C.
| 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 108 of file regExp.C.
| 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 125 of file regExp.C.
Referenced by Foam::findStrings().
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 148 of file regExp.C.
| bool search |
( |
const std::string & |
str |
) |
const [inline] |
Return true if the regex was found in within string.
Definition at line 167 of file regExp.H.
| void operator= |
( |
const char * |
pat |
) |
|
Assign and compile pattern from a character array.
Always case sensitive
Definition at line 195 of file regExp.C.
| void operator= |
( |
const std::string & |
pat |
) |
|
Assign and compile pattern from string.
Always case sensitive
Definition at line 201 of file regExp.C.
The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd