aboutsummaryrefslogtreecommitdiffstats
path: root/vsm
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-03-13 00:34:52 +0100
committerTor Egge <Tor.Egge@broadpark.no>2019-03-13 00:34:52 +0100
commit1fc21c3b657cb70997cd1215636dd00356b20e7d (patch)
tree74fa55ca4eb0246bcf2040e48469bf7ce348ed48 /vsm
parentd8ecba43c97b03cd84497ac9d6cd8a803540ed16 (diff)
Use std::basic_regex to strip down field path.
Diffstat (limited to 'vsm')
-rw-r--r--vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp b/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp
index 351c2d1da0d..9131b21ddc9 100644
--- a/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp
+++ b/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp
@@ -10,7 +10,7 @@
#include <vespa/vsm/searcher/intfieldsearcher.h>
#include <vespa/vsm/searcher/boolfieldsearcher.h>
#include <vespa/vsm/searcher/floatfieldsearcher.h>
-#include <vespa/vespalib/util/regexp.h>
+#include <regex>
#include <vespa/log/log.h>
LOG_SETUP(".vsm.fieldsearchspec");
@@ -154,19 +154,19 @@ FieldSearchSpecMap::FieldSearchSpecMap() :
FieldSearchSpecMap::~FieldSearchSpecMap() {}
namespace {
- const vespalib::string _G_empty("");
- const vespalib::string _G_value(".value");
- const vespalib::Regexp _G_map1("\\{[a-zA-Z0-9]+\\}");
- const vespalib::Regexp _G_map2("\\{\".*\"\\}");
- const vespalib::Regexp _G_array("\\[[0-9]+\\]");
+ const std::string _G_empty("");
+ const std::string _G_value(".value");
+ const std::basic_regex _G_map1("\\{[a-zA-Z0-9]+\\}");
+ const std::basic_regex _G_map2("\\{\".*\"\\}");
+ const std::basic_regex _G_array("\\[[0-9]+\\]");
}
vespalib::string FieldSearchSpecMap::stripNonFields(const vespalib::string & rawIndex)
{
if ((rawIndex.find('[') != vespalib::string::npos) || (rawIndex.find('{') != vespalib::string::npos)) {
- std::string index = _G_map1.replace(rawIndex, _G_value);
- index = _G_map2.replace(index, _G_value);
- index = _G_array.replace(index, _G_empty);
+ std::string index = std::regex_replace(std::string(rawIndex), _G_map1, _G_value);
+ index = std::regex_replace(index, _G_map2, _G_value);
+ index = std::regex_replace(index, _G_array, _G_empty);
return index;
}
return rawIndex;