57 #include <sys/types.h> 67 #include "rnr/rnrconfig.h" 93 static const int ReOk = REG_NOERROR;
141 RegEx(
int nFlags = ReFlagDefaults);
151 RegEx(
const std::string &strRegEx,
int nFlags = ReFlagDefaults);
161 RegEx(
const char *sRegEx,
int nFlags = ReFlagDefaults);
223 bool match(
const std::string &strInput,
const int nFlags = ReFlagDefaults);
225 bool match(
const std::string &strInput,
226 const int nFlags = ReFlagDefaults)
const;
242 bool match(
const char *sInput,
const int nFlags = ReFlagDefaults);
244 bool match(
const char *sInput,
const int nFlags = ReFlagDefaults)
const;
297 size_t match(
const std::string &strInput,
299 const size_t uMaxSubMatches = ReMaxSubMatchesDft,
300 const int nFlags = ReFlagDefaults);
302 size_t match(
const std::string &strInput,
304 const size_t uMaxSubMatches = ReMaxSubMatchesDft,
305 const int nFlags = ReFlagDefaults)
const;
323 size_t match(
const char *sInput,
325 const size_t uMaxSubMatches = ReMaxSubMatchesDft,
326 const int nFlags = ReFlagDefaults);
328 size_t match(
const char *sInput,
330 const size_t uMaxSubMatches = ReMaxSubMatchesDft,
331 const int nFlags = ReFlagDefaults)
const;
479 #endif // _RNR_REGEX_H static const int ReFlagICase
ignore case when matching
std::vector< ReMatch > ReMatchVec
vector of matches
static const int ReOk
Special return and error codes.
size_t m_uEnd
ending index in input where match is found
static const int ReENotComp
not compiled
void setError(const int nCode)
Set the error code and associated error string.
int getReturnCode() const
Get the extened return code from the last RegEx operation.
const std::string & getRegEx() const
Get the pre-compiled regular expression.
int m_nFlags
compile and matching flags
void freeReMem()
Free compiled regular expression memory.
std::string m_strReError
compiled regualar expresson error string
static const size_t ReMaxSubMatchesDft
regex_t m_regex
compiled reqular expression
static const int ReFlagNotBoL
input not begin of line
size_t m_uStart
starting index in input where match is found
friend std::istream & operator>>(std::istream &is, RegEx &re)
Extract from input stream to object.
const std::string & getErrorStr() const
Get the last RegExs operation error string.
std::string m_strMatch
matching (sub)string
static const int ReENoExpr
no pre-compiled express
RegEx & operator=(const RegEx &rhs)
Assignment copy operator.
void groomFlags(const int nFlags)
Groom compile behavior flags, disabling any unsupported flags.
Regular expression match structure.
std::string m_strRegEx
pre-compiled regular expression string
friend std::ostream & operator<<(std::ostream &os, const RegEx &re)
Insert object into output stream.
static const int ReFlagNewLine
force bol/eol matching
bool match(const std::string &strInput, const int nFlags=ReFlagDefaults)
Match the input string against the regular expression.
bool m_bIsValid
expression [not] successfully compiled
int getFlags() const
Get compile behavior flags.
int m_nReCode
compiled regular expression return code
virtual ~RegEx()
Default destructor.
RegEx(int nFlags=ReFlagDefaults)
Default constructor.
static const int ReFlagNotEoL
input not end of line
bool isValid() const
Test if in a valid state (i.e. compiled).
static const int ReFlagDefaults
Regular expression compile and matching behavior flags.
static const char * ReInvalid
Concerning, in reality, in regards to invalid regular expressions.
bool compile()
Compile the regular expression string.
void setFlags(int nFlags)
Set new compile behavior flags.