summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-05-28 07:39:52 +0000
committerArne Juul <arnej@verizonmedia.com>2020-05-28 08:16:59 +0000
commitce1d1e4a5f6b314f937ce1713b9fee5c21427192 (patch)
tree71013057e05981b1d3efa351c1a40bbef37c1bb3 /vespalib
parentec94e96642e4068f173e1063badc92da8b17366f (diff)
add multiline regex option
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/regex/regex.cpp3
-rw-r--r--vespalib/src/vespa/vespalib/regex/regex.h3
2 files changed, 5 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/regex/regex.cpp b/vespalib/src/vespa/vespalib/regex/regex.cpp
index 3229365b753..fcae9b3f11a 100644
--- a/vespalib/src/vespa/vespalib/regex/regex.cpp
+++ b/vespalib/src/vespa/vespalib/regex/regex.cpp
@@ -58,6 +58,9 @@ Regex Regex::from_pattern(std::string_view pattern, uint32_t opt_mask) {
if ((opt_mask & Options::IgnoreCase) != 0) {
opts.set_case_sensitive(false);
}
+ if ((opt_mask & Options::MultiLine) != 0) {
+ opts.set_dot_nl(true);
+ }
return Regex(std::make_shared<const Impl>(pattern, opts));
}
diff --git a/vespalib/src/vespa/vespalib/regex/regex.h b/vespalib/src/vespa/vespalib/regex/regex.h
index 4382d057252..01207ee3e49 100644
--- a/vespalib/src/vespa/vespalib/regex/regex.h
+++ b/vespalib/src/vespa/vespalib/regex/regex.h
@@ -44,7 +44,8 @@ public:
// TODO consider using type-safe parameter instead.
enum Options {
None = 0,
- IgnoreCase = 1
+ IgnoreCase = 1,
+ MultiLine = 2
};
~Regex();