libaurum: Change text matching way to avoid use regex 10/272310/1
authorWoochanlee <wc0917.lee@samsung.com>
Mon, 14 Mar 2022 10:02:09 +0000 (19:02 +0900)
committerWoochanlee <wc0917.lee@samsung.com>
Mon, 14 Mar 2022 10:02:09 +0000 (19:02 +0900)
regex can't search text which has '('

Change-Id: I7ca10cb75ba77753e0c0d215b91799d53d429cad

libaurum/src/PartialMatch.cc

index c1cd80a0c9c20fe697324bd7f6328c0f358f5390..54332b4b2a8e63e2564500bfd843d40bc4499590 100644 (file)
@@ -26,10 +26,18 @@ using namespace Aurum;
 
 bool PartialMatch::checkCriteria(const std::string textA, const std::string textB, const bool textPartialMatch)
 {
-    std::regex re(textA);
+    if (textB.empty()) return true;
+
     bool rst;
-    if (textPartialMatch) rst = !(!!std::regex_search(textB, re) == true);
-    else rst = !(!!std::regex_match(textB, re) == true);
+    if (textPartialMatch) {
+        if (textB.find(textA) != std::string::npos) rst = false;
+        else rst = true;
+    }
+    else {
+        if (!textA.compare(textB)) rst = false;
+        else rst = true;
+    }
+
     return rst;
 }