/** @file
$Id$
$Date$
$Author$
@copy © Marc Wäckerlin
@license LGPL, see file COPYING
$Log$
Revision 1.1 2004/12/14 20:20:30 marc
initial version
*/
#include
#include
namespace mrw {
RegExp::RegExp(const std::string& pattern, int flags)
throw(std::exception, std::bad_exception) {
if (regcomp(&_regex, pattern.c_str(), flags|nosub))
throw(mrw::invalid_argument(pattern));
}
RegExp::~RegExp() throw() {
regfree(&_regex);
}
bool RegExp::operator()(const std::string& text) const throw() {
return !regexec(const_cast(&_regex), text.c_str(), 0, 0, 0);
}
}