Logo Search packages:      
Sourcecode: paco version File versions  Download package

regexp.cc

#include "regexp.h"
#include <string>


using namespace Paco;
using std::string;


Regexp::Regexp(string const& exp, bool icase /* = 0 */)
:
      mOk(false)
{
      mOk = !regcomp(&mRegex, exp.c_str(), REG_NOSUB | REG_EXTENDED | (REG_ICASE & icase));
}


Regexp::~Regexp()
{
      regfree(&mRegex);
}


bool Regexp::run(string const& str)
{
      return mOk && regexec(&mRegex, str.c_str(), 0, 0, 0) != REG_NOMATCH;
}


Generated by  Doxygen 1.6.0   Back to index