<commit_before>#include "RE2Engine.h"

using namespace regexbench;

RE2Engine::RE2Engine() = default;

RE2Engine::~RE2Engine() = default;

void RE2Engine::compile(const std::vector<Rule> &rules) {
  for (const auto &rule : rules) {
    res.push_back(std::unique_ptr<::RE2>(new RE2{rule.getRegexp().data()}));
  }
}

bool RE2Engine::match(const char *data, size_t len) {
  len = 0;
  for (const auto &re : res) {
    if (RE2::FullMatch(data, *re))
      return true;
  }
  return false;
}

<commit_msg>Set re2 options<commit_after>#include "RE2Engine.h"

using namespace regexbench;

RE2Engine::RE2Engine() = default;

RE2Engine::~RE2Engine() = default;

void RE2Engine::compile(const std::vector<Rule> &rules) {
  RE2::Options op;
  op.set_dot_nl(true);
  op.set_case_sensitive(false);
  op.set_one_line(false);

  for (const auto &rule : rules) {
    res.push_back(std::unique_ptr<RE2>(new RE2{rule.getRegexp().data(), op}));
  }
}

bool RE2Engine::match(const char *data, size_t len) {
  len = 0;
  for (const auto &re : res) {
    if (RE2::FullMatch(data, *re))
      return true;
  }
  return false;
}


{'fraction_non_alphanumeric': 0.16440831074977416, 'fraction_numerical': 0.02168021680216802, 'mean_word_length': 4.567839195979899, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6228233', 'n_tokens_mistral': 429, 'n_tokens_neox': 426, 'n_words': 88}