Adds variable TX and action "capture".

This commit is contained in:
Felipe Zimmerle
2015-08-05 10:07:47 -03:00
parent be4a0cb41c
commit 4f47651a6f
34 changed files with 338 additions and 30 deletions

View File

@@ -40,13 +40,20 @@ Regex::Regex(const std::string& pattern_)
int regex_search(const std::string& s, SMatch *match,
const Regex& regex) {
std::string m;
pcrecpp::RE re(regex.pattern,
pcrecpp::RE_Options(PCRE_DOTALL|PCRE_MULTILINE));
/** FIXME: Should be not necessary to call PartialMatch twice here. */
match->size_ = re.PartialMatch(s);
re.PartialMatch(s, &m);
match->match = m;
return match->size_;
}
int regex_search(const std::string& s, Regex regex) {
std::string match;
pcrecpp::RE re(regex.pattern);
return re.PartialMatch(s);
}

View File

@@ -37,6 +37,7 @@ class SMatch {
SMatch() : size_(0) { }
size_t size() { return size_; }
int size_;
std::string match;
};