regex: modernize and simplify code

Change-Id: Ia4a3046d409ab1e5d8507da4d369dfee203f6256
diff --git a/src/security/v2/validator-config/checker.cpp b/src/security/v2/validator-config/checker.cpp
index fdff8d2..dc4d49a 100644
--- a/src/security/v2/validator-config/checker.cpp
+++ b/src/security/v2/validator-config/checker.cpp
@@ -258,7 +258,7 @@
     }
 
     try {
-      return make_unique<RegexChecker>(regexString);
+      return make_unique<RegexChecker>(Regex(regexString));
     }
     catch (const Regex::Error& e) {
       BOOST_THROW_EXCEPTION(Error("Invalid checker.key-locator.regex: " + regexString));
diff --git a/src/security/v2/validator-config/filter.cpp b/src/security/v2/validator-config/filter.cpp
index baeba1d..1379c98 100644
--- a/src/security/v2/validator-config/filter.cpp
+++ b/src/security/v2/validator-config/filter.cpp
@@ -132,7 +132,7 @@
       BOOST_THROW_EXCEPTION(Error("Expect the end of filter"));
 
     try {
-      return make_unique<RegexNameFilter>(regexString);
+      return make_unique<RegexNameFilter>(Regex(regexString));
     }
     catch (const Regex::Error& e) {
       BOOST_THROW_EXCEPTION(Error("Wrong filter.regex: " + regexString));