regex: remove unnecessary virtual function

Refs: #5144
Change-Id: Ib587b14acf763ae366e4b8c18938d2c23a196eaf
diff --git a/ndn-cxx/util/regex.hpp b/ndn-cxx/util/regex.hpp
index 4f8d7dd..7ca5ccd 100644
--- a/ndn-cxx/util/regex.hpp
+++ b/ndn-cxx/util/regex.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,15 +21,15 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_HPP
-#define NDN_UTIL_REGEX_HPP
+#ifndef NDN_CXX_UTIL_REGEX_HPP
+#define NDN_CXX_UTIL_REGEX_HPP
 
 #include "ndn-cxx/util/regex/regex-top-matcher.hpp"
 
 namespace ndn {
 
-typedef RegexTopMatcher Regex;
+using Regex = RegexTopMatcher;
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_HPP
+#endif // NDN_CXX_UTIL_REGEX_HPP
diff --git a/ndn-cxx/util/regex/regex-backref-manager.hpp b/ndn-cxx/util/regex/regex-backref-manager.hpp
index 3d5b717..157fcf1 100644
--- a/ndn-cxx/util/regex/regex-backref-manager.hpp
+++ b/ndn-cxx/util/regex/regex-backref-manager.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_BACKREF_MANAGER_HPP
-#define NDN_UTIL_REGEX_REGEX_BACKREF_MANAGER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_BACKREF_MANAGER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_BACKREF_MANAGER_HPP
 
 #include "ndn-cxx/detail/common.hpp"
 
@@ -59,4 +59,4 @@
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_BACKREF_MANAGER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_BACKREF_MANAGER_HPP
diff --git a/ndn-cxx/util/regex/regex-backref-matcher.hpp b/ndn-cxx/util/regex/regex-backref-matcher.hpp
index 30ededd..be9844e 100644
--- a/ndn-cxx/util/regex/regex-backref-matcher.hpp
+++ b/ndn-cxx/util/regex/regex-backref-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
-#define NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
 
 #include "ndn-cxx/util/regex/regex-matcher.hpp"
 
@@ -31,19 +31,13 @@
 class RegexBackrefMatcher : public RegexMatcher
 {
 public:
-  RegexBackrefMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backrefManager);
+  RegexBackrefMatcher(const std::string& expr,
+                      shared_ptr<RegexBackrefManager> backrefManager);
 
   void
-  lateCompile()
-  {
-    compile();
-  }
-
-protected:
-  void
-  compile() override;
+  compile();
 };
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
diff --git a/ndn-cxx/util/regex/regex-component-matcher.hpp b/ndn-cxx/util/regex/regex-component-matcher.hpp
index c0b1a3e..ee20fa1 100644
--- a/ndn-cxx/util/regex/regex-component-matcher.hpp
+++ b/ndn-cxx/util/regex/regex-component-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
-#define NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
 
 #include "ndn-cxx/util/regex/regex-matcher.hpp"
 
@@ -48,9 +48,9 @@
   bool
   match(const Name& name, size_t offset, size_t len = 1) override;
 
-protected:
+private:
   void
-  compile() override;
+  compile();
 
 private:
   bool m_isExactMatch;
@@ -60,4 +60,4 @@
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
diff --git a/ndn-cxx/util/regex/regex-component-set-matcher.hpp b/ndn-cxx/util/regex/regex-component-set-matcher.hpp
index 2aacbca..4b39afa 100644
--- a/ndn-cxx/util/regex/regex-component-set-matcher.hpp
+++ b/ndn-cxx/util/regex/regex-component-set-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
-#define NDN_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
 
 #include "ndn-cxx/util/regex/regex-matcher.hpp"
 
@@ -40,20 +40,17 @@
    * @param expr The standard regular expression to match a component
    * @param backrefManager Shared pointer to back-reference manager
    */
-  RegexComponentSetMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backrefManager);
+  RegexComponentSetMatcher(const std::string& expr,
+                           shared_ptr<RegexBackrefManager> backrefManager);
 
   bool
   match(const Name& name, size_t offset, size_t len = 1) override;
 
-protected:
-  /**
-   * @brief Compile the regular expression to generate the more matchers when necessary
-   */
-  void
-  compile() override;
-
 private:
   void
+  compile();
+
+  void
   compileSingleComponent();
 
   void
@@ -69,4 +66,4 @@
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
diff --git a/ndn-cxx/util/regex/regex-matcher.cpp b/ndn-cxx/util/regex/regex-matcher.cpp
index 39fe715..1b485d8 100644
--- a/ndn-cxx/util/regex/regex-matcher.cpp
+++ b/ndn-cxx/util/regex/regex-matcher.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -25,7 +25,7 @@
 
 namespace ndn {
 
-RegexMatcher::RegexMatcher(const std::string& expr, const RegexExprType& type,
+RegexMatcher::RegexMatcher(const std::string& expr, RegexExprType type,
                            shared_ptr<RegexBackrefManager> backrefManager)
   : m_expr(expr)
   , m_type(type)
diff --git a/ndn-cxx/util/regex/regex-matcher.hpp b/ndn-cxx/util/regex/regex-matcher.hpp
index 6cc0dbc..9008cd3 100644
--- a/ndn-cxx/util/regex/regex-matcher.hpp
+++ b/ndn-cxx/util/regex/regex-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_MATCHER_HPP
-#define NDN_UTIL_REGEX_REGEX_MATCHER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_MATCHER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_MATCHER_HPP
 
 #include "ndn-cxx/util/regex/regex-backref-manager.hpp"
 #include "ndn-cxx/name.hpp"
@@ -48,15 +48,18 @@
     EXPR_PSEUDO
   };
 
-  RegexMatcher(const std::string& expr, const RegexExprType& type,
-               shared_ptr<RegexBackrefManager> backrefManager = nullptr);
-
   virtual
   ~RegexMatcher();
 
   virtual bool
   match(const Name& name, size_t offset, size_t len);
 
+  const std::string&
+  getExpr() const
+  {
+    return m_expr;
+  }
+
   /**
    * @brief get the matched name components
    * @returns the matched name components
@@ -67,18 +70,9 @@
     return m_matchResult;
   }
 
-  const std::string&
-  getExpr() const
-  {
-    return m_expr;
-  }
-
 protected:
-  /**
-   * @brief Compile the regular expression to generate the more matchers when necessary
-   */
-  virtual void
-  compile() = 0;
+  RegexMatcher(const std::string& expr, RegexExprType type,
+               shared_ptr<RegexBackrefManager> backrefManager = nullptr);
 
 private:
   bool
@@ -97,4 +91,4 @@
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_MATCHER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_MATCHER_HPP
diff --git a/ndn-cxx/util/regex/regex-pattern-list-matcher.cpp b/ndn-cxx/util/regex/regex-pattern-list-matcher.cpp
index a0464c3..827d523 100644
--- a/ndn-cxx/util/regex/regex-pattern-list-matcher.cpp
+++ b/ndn-cxx/util/regex/regex-pattern-list-matcher.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -66,12 +66,13 @@
       auto matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(start, end - start),
                                                       m_backrefManager);
       m_backrefManager->pushRef(matcher);
-      matcher->lateCompile();
+      matcher->compile();
       m_matchers.push_back(std::move(matcher));
     }
-    else
+    else {
       m_matchers.push_back(make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start),
                                                            m_backrefManager, indicator - start));
+    }
     break;
 
   case '<':
diff --git a/ndn-cxx/util/regex/regex-pattern-list-matcher.hpp b/ndn-cxx/util/regex/regex-pattern-list-matcher.hpp
index f814dee..254b068 100644
--- a/ndn-cxx/util/regex/regex-pattern-list-matcher.hpp
+++ b/ndn-cxx/util/regex/regex-pattern-list-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
-#define NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
 
 #include "ndn-cxx/util/regex/regex-matcher.hpp"
 
@@ -31,13 +31,13 @@
 class RegexPatternListMatcher : public RegexMatcher
 {
 public:
-  RegexPatternListMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backrefManager);
-
-protected:
-  void
-  compile() override;
+  RegexPatternListMatcher(const std::string& expr,
+                          shared_ptr<RegexBackrefManager> backrefManager);
 
 private:
+  void
+  compile();
+
   bool
   extractPattern(size_t index, size_t* next);
 
@@ -50,4 +50,4 @@
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
diff --git a/ndn-cxx/util/regex/regex-pseudo-matcher.cpp b/ndn-cxx/util/regex/regex-pseudo-matcher.cpp
index fc5e951..9a432e4 100644
--- a/ndn-cxx/util/regex/regex-pseudo-matcher.cpp
+++ b/ndn-cxx/util/regex/regex-pseudo-matcher.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -33,7 +33,7 @@
 void
 RegexPseudoMatcher::setMatchResult(const std::string& str)
 {
-  m_matchResult.push_back(name::Component(reinterpret_cast<const uint8_t*>(str.data()), str.size()));
+  m_matchResult.emplace_back(reinterpret_cast<const uint8_t*>(str.data()), str.size());
 }
 
 void
@@ -42,9 +42,4 @@
   m_matchResult.clear();
 }
 
-void
-RegexPseudoMatcher::compile()
-{
-}
-
 } // namespace ndn
diff --git a/ndn-cxx/util/regex/regex-pseudo-matcher.hpp b/ndn-cxx/util/regex/regex-pseudo-matcher.hpp
index 4317027..8d99610 100644
--- a/ndn-cxx/util/regex/regex-pseudo-matcher.hpp
+++ b/ndn-cxx/util/regex/regex-pseudo-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
-#define NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
 
 #include "ndn-cxx/util/regex/regex-matcher.hpp"
 
@@ -38,12 +38,8 @@
 
   void
   resetMatchResult();
-
-protected:
-  void
-  compile() override;
 };
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
diff --git a/ndn-cxx/util/regex/regex-repeat-matcher.cpp b/ndn-cxx/util/regex/regex-repeat-matcher.cpp
index 159dc41..031edd0 100644
--- a/ndn-cxx/util/regex/regex-repeat-matcher.cpp
+++ b/ndn-cxx/util/regex/regex-repeat-matcher.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -45,7 +45,7 @@
   if ('(' == m_expr[0]) {
     auto matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(0, m_indicator), m_backrefManager);
     m_backrefManager->pushRef(matcher);
-    matcher->lateCompile();
+    matcher->compile();
     m_matchers.push_back(std::move(matcher));
   }
   else {
@@ -110,11 +110,13 @@
       min = std::atoi(repeatStruct.substr(1, rsSize - 1).data());
       max = min;
     }
-    else
+    else {
       NDN_THROW(Error("parseRepetition: unrecognized format " + m_expr));
+    }
 
-    if (min > MAX_REPETITIONS || max > MAX_REPETITIONS || min > max)
+    if (min > MAX_REPETITIONS || max > MAX_REPETITIONS || min > max) {
       NDN_THROW(Error("parseRepetition: wrong number " + m_expr));
+    }
 
     m_repeatMin = min;
     m_repeatMax = max;
diff --git a/ndn-cxx/util/regex/regex-repeat-matcher.hpp b/ndn-cxx/util/regex/regex-repeat-matcher.hpp
index 5e92edb..6ba336a 100644
--- a/ndn-cxx/util/regex/regex-repeat-matcher.hpp
+++ b/ndn-cxx/util/regex/regex-repeat-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
-#define NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
 
 #include "ndn-cxx/util/regex/regex-matcher.hpp"
 
@@ -38,11 +38,10 @@
   bool
   match(const Name& name, size_t offset, size_t len) override;
 
-protected:
-  void
-  compile() override;
-
 private:
+  void
+  compile();
+
   bool
   parseRepetition();
 
@@ -57,4 +56,4 @@
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
diff --git a/ndn-cxx/util/regex/regex-top-matcher.hpp b/ndn-cxx/util/regex/regex-top-matcher.hpp
index f580a31..84ffd25 100644
--- a/ndn-cxx/util/regex/regex-top-matcher.hpp
+++ b/ndn-cxx/util/regex/regex-top-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
-#define NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
+#ifndef NDN_CXX_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
+#define NDN_CXX_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
 
 #include "ndn-cxx/util/regex/regex-matcher.hpp"
 
@@ -49,11 +49,10 @@
   static shared_ptr<RegexTopMatcher>
   fromName(const Name& name, bool hasAnchor = false);
 
-protected:
-  void
-  compile() override;
-
 private:
+  void
+  compile();
+
   static std::string
   getItemFromExpand(const std::string& expand, size_t& offset);
 
@@ -71,4 +70,4 @@
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
+#endif // NDN_CXX_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
diff --git a/tests/unit/util/regex.t.cpp b/tests/unit/util/regex.t.cpp
index 2804cc4..b4fc02e 100644
--- a/tests/unit/util/regex.t.cpp
+++ b/tests/unit/util/regex.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -257,7 +257,7 @@
   shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
   shared_ptr<RegexBackrefMatcher> cm = make_shared<RegexBackrefMatcher>("(<a><b>)", backRef);
   backRef->pushRef(static_pointer_cast<RegexMatcher>(cm));
-  cm->lateCompile();
+  cm->compile();
   bool res = cm->match(Name("/a/b/c"), 0, 2);
   BOOST_CHECK_EQUAL(res, true);
   BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
@@ -268,7 +268,7 @@
   backRef = make_shared<RegexBackrefManager>();
   cm = make_shared<RegexBackrefMatcher>("(<a>(<b>))", backRef);
   backRef->pushRef(cm);
-  cm->lateCompile();
+  cm->compile();
   res = cm->match(Name("/a/b/c"), 0, 2);
   BOOST_CHECK_EQUAL(res, true);
   BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);