summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-03-26 15:38:13 +0100
committerTor Egge <Tor.Egge@broadpark.no>2019-03-26 15:38:13 +0100
commit17ba992eb28b34879f736ff203d119c4f10c9792 (patch)
tree3e181b0a1e2dc3ca4ca21e0010d6ba02d06c22b3 /document
parent1e2a55fbaae5779f8cc0f2938087484c7478d212 (diff)
Use std::basic_regex in document module.
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/select/operator.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/document/src/vespa/document/select/operator.cpp b/document/src/vespa/document/select/operator.cpp
index 1b97a375a5f..36113844d88 100644
--- a/document/src/vespa/document/select/operator.cpp
+++ b/document/src/vespa/document/select/operator.cpp
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "operator.h"
-#include <vespa/vespalib/util/regexp.h>
+#include <regex>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <cassert>
@@ -127,8 +127,12 @@ RegexOperator::match(const vespalib::string& val, vespalib::stringref expr) cons
{
// Should we catch this in parsing?
if (expr.size() == 0) return ResultList(Result::True);
- vespalib::Regexp expression(expr);
- return ResultList(Result::get(expression.match(val)));
+ try {
+ std::basic_regex<char> expression(expr.data(), expr.size());
+ return ResultList(Result::get(std::regex_search(val.c_str(), val.c_str() + val.size(), expression)));
+ } catch (std::regex_error &) {
+ return ResultList(Result::False);
+ }
}
const RegexOperator RegexOperator::REGEX("=~");