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));
diff --git a/src/util/regex/regex-backref-manager.hpp b/src/util/regex/regex-backref-manager.hpp
index be0f3dd..4e112d7 100644
--- a/src/util/regex/regex-backref-manager.hpp
+++ b/src/util/regex/regex-backref-manager.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -39,10 +39,16 @@
   pushRef(const shared_ptr<RegexMatcher>& matcher);
 
   void
-  popRef();
+  popRef()
+  {
+    m_backrefs.pop_back();
+  }
 
   size_t
-  size() const;
+  size() const
+  {
+    return m_backrefs.size();
+  }
 
   shared_ptr<RegexMatcher>
   getBackref(size_t i) const;
@@ -51,28 +57,14 @@
   std::vector<weak_ptr<RegexMatcher>> m_backrefs;
 };
 
-
 inline size_t
 RegexBackrefManager::pushRef(const shared_ptr<RegexMatcher>& matcher)
 {
-  size_t last = m_backrefs.size();
-  m_backrefs.push_back(matcher);
-
+  auto last = m_backrefs.size();
+  m_backrefs.emplace_back(matcher);
   return last;
 }
 
-inline void
-RegexBackrefManager::popRef()
-{
-  m_backrefs.pop_back();
-}
-
-inline size_t
-RegexBackrefManager::size() const
-{
-  return m_backrefs.size();
-}
-
 inline shared_ptr<RegexMatcher>
 RegexBackrefManager::getBackref(size_t i) const
 {
diff --git a/src/util/regex/regex-backref-matcher.hpp b/src/util/regex/regex-backref-matcher.hpp
index d514572..947abc7 100644
--- a/src/util/regex/regex-backref-matcher.hpp
+++ b/src/util/regex/regex-backref-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,8 +24,6 @@
 #ifndef NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
 #define NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
 
-#include "../../common.hpp"
-
 #include "regex-matcher.hpp"
 
 namespace ndn {
@@ -35,11 +33,6 @@
 public:
   RegexBackrefMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backrefManager);
 
-  virtual
-  ~RegexBackrefMatcher()
-  {
-  }
-
   void
   lateCompile()
   {
@@ -47,8 +40,8 @@
   }
 
 protected:
-  virtual void
-  compile();
+  void
+  compile() override;
 };
 
 } // namespace ndn
@@ -60,30 +53,25 @@
 inline
 RegexBackrefMatcher::RegexBackrefMatcher(const std::string& expr,
                                          shared_ptr<RegexBackrefManager> backrefManager)
-  : RegexMatcher(expr, EXPR_BACKREF, backrefManager)
+  : RegexMatcher(expr, EXPR_BACKREF, std::move(backrefManager))
 {
-  // compile();
 }
 
 inline void
 RegexBackrefMatcher::compile()
 {
   if (m_expr.size() < 2)
-    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Unrecognized format: " + m_expr));
+    BOOST_THROW_EXCEPTION(Error("Unrecognized format: " + m_expr));
 
   size_t lastIndex = m_expr.size() - 1;
   if ('(' == m_expr[0] && ')' == m_expr[lastIndex]) {
-    // m_backRefManager->pushRef(this);
-
-    shared_ptr<RegexMatcher> matcher(new RegexPatternListMatcher(m_expr.substr(1, lastIndex - 1),
-                                                                 m_backrefManager));
-    m_matchers.push_back(matcher);
+    m_matchers.push_back(make_shared<RegexPatternListMatcher>(m_expr.substr(1, lastIndex - 1),
+                                                              m_backrefManager));
   }
   else
-    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Unrecognized format: " + m_expr));
+    BOOST_THROW_EXCEPTION(Error("Unrecognized format: " + m_expr));
 }
 
-
 } // namespace ndn
 
 #endif // NDN_UTIL_REGEX_REGEX_BACKREF_MATCHER_HPP
diff --git a/src/util/regex/regex-component-matcher.hpp b/src/util/regex/regex-component-matcher.hpp
index 08cefdb..3140375 100644
--- a/src/util/regex/regex-component-matcher.hpp
+++ b/src/util/regex/regex-component-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,11 +24,11 @@
 #ifndef NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
 #define NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
 
-#include <boost/regex.hpp>
-
 #include "regex-matcher.hpp"
 #include "regex-pseudo-matcher.hpp"
 
+#include <boost/regex.hpp>
+
 namespace ndn {
 
 class RegexComponentMatcher : public RegexMatcher
@@ -44,34 +44,24 @@
                         shared_ptr<RegexBackrefManager> backrefManager,
                         bool isExactMatch = true);
 
-  virtual
-  ~RegexComponentMatcher()
-  {
-  }
-
-  virtual bool
-  match(const Name& name, size_t offset, size_t len = 1);
+  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
-   */
-  virtual void
-  compile();
+  void
+  compile() override;
 
 private:
   bool m_isExactMatch;
   boost::regex m_componentRegex;
-  std::vector<shared_ptr<RegexPseudoMatcher> > m_pseudoMatchers;
-
+  std::vector<shared_ptr<RegexPseudoMatcher>> m_pseudoMatchers;
 };
 
-
 inline
 RegexComponentMatcher::RegexComponentMatcher(const std::string& expr,
                                              shared_ptr<RegexBackrefManager> backrefManager,
                                              bool isExactMatch)
-  : RegexMatcher(expr, EXPR_COMPONENT, backrefManager)
+  : RegexMatcher(expr, EXPR_COMPONENT, std::move(backrefManager))
   , m_isExactMatch(isExactMatch)
 {
   compile();
@@ -82,11 +72,12 @@
 //   Breaking change: corrected behavior of basic_regex<>::mark_count() to match existing
 //   documentation, basic_regex<>::subexpression(n) changed to match, see
 //   https://svn.boost.org/trac/boost/ticket/9227
-static const size_t BOOST_REGEXP_MARK_COUNT_CORRECTION =
+//
+static constexpr size_t BOOST_REGEXP_MARK_COUNT_CORRECTION =
 #if BOOST_VERSION < 105600
-                    1;
+    1;
 #else
-                    0;
+    0;
 #endif
 
 inline void
@@ -97,13 +88,10 @@
   m_pseudoMatchers.clear();
   m_pseudoMatchers.push_back(make_shared<RegexPseudoMatcher>());
 
-  for (size_t i = 1;
-       i <= m_componentRegex.mark_count() - BOOST_REGEXP_MARK_COUNT_CORRECTION; i++)
-    {
-      shared_ptr<RegexPseudoMatcher> pMatcher = make_shared<RegexPseudoMatcher>();
-      m_pseudoMatchers.push_back(pMatcher);
-      m_backrefManager->pushRef(static_pointer_cast<RegexMatcher>(pMatcher));
-    }
+  for (size_t i = 1; i <= m_componentRegex.mark_count() - BOOST_REGEXP_MARK_COUNT_CORRECTION; i++) {
+    m_pseudoMatchers.push_back(make_shared<RegexPseudoMatcher>());
+    m_backrefManager->pushRef(m_pseudoMatchers.back());
+  }
 }
 
 inline bool
@@ -111,38 +99,28 @@
 {
   m_matchResult.clear();
 
-  if (m_expr.empty())
-    {
-      m_matchResult.push_back(name.get(offset));
-      return true;
-    }
+  if (m_expr.empty()) {
+    m_matchResult.push_back(name.get(offset));
+    return true;
+  }
 
-  if (m_isExactMatch)
-    {
-      boost::smatch subResult;
-      std::string targetStr = name.get(offset).toUri();
-      if (boost::regex_match(targetStr, subResult, m_componentRegex))
-        {
-          for (size_t i = 1;
-               i <= m_componentRegex.mark_count() - BOOST_REGEXP_MARK_COUNT_CORRECTION; i++)
-            {
-              m_pseudoMatchers[i]->resetMatchResult();
-              m_pseudoMatchers[i]->setMatchResult(subResult[i]);
-            }
-          m_matchResult.push_back(name.get(offset));
-          return true;
-        }
+  if (!m_isExactMatch)
+    BOOST_THROW_EXCEPTION(Error("Non-exact component search is not supported yet"));
+
+  boost::smatch subResult;
+  std::string targetStr = name.get(offset).toUri();
+  if (boost::regex_match(targetStr, subResult, m_componentRegex)) {
+    for (size_t i = 1; i <= m_componentRegex.mark_count() - BOOST_REGEXP_MARK_COUNT_CORRECTION; i++) {
+      m_pseudoMatchers[i]->resetMatchResult();
+      m_pseudoMatchers[i]->setMatchResult(subResult[i]);
     }
-  else
-    {
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Non-exact component search is not supported "
-                                                "yet"));
-    }
+    m_matchResult.push_back(name.get(offset));
+    return true;
+  }
 
   return false;
 }
 
-
 } // namespace ndn
 
 #endif // NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP
diff --git a/src/util/regex/regex-component-set-matcher.hpp b/src/util/regex/regex-component-set-matcher.hpp
index 7bf5a5e..46d8527 100644
--- a/src/util/regex/regex-component-set-matcher.hpp
+++ b/src/util/regex/regex-component-set-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,13 +21,11 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_COMPONENT_SET_MATCHER_HPP
-#define NDN_UTIL_REGEX_COMPONENT_SET_MATCHER_HPP
+#ifndef NDN_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
 
-#include "../../common.hpp"
-
-#include "regex-matcher.hpp"
 #include "regex-component-matcher.hpp"
+#include "regex-matcher.hpp"
 
 #include <set>
 
@@ -43,66 +41,53 @@
    */
   RegexComponentSetMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backrefManager);
 
-  virtual
-  ~RegexComponentSetMatcher();
-
-  virtual bool
-  match(const Name& name, size_t offset, size_t len = 1);
+  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
    */
-  virtual void
-  compile();
+  void
+  compile() override;
 
 private:
-  size_t
-  extractComponent(size_t index);
-
   void
   compileSingleComponent();
 
   void
   compileMultipleComponents(size_t start, size_t lastIndex);
 
+  size_t
+  extractComponent(size_t index) const;
+
 private:
-  typedef std::set<shared_ptr<RegexComponentMatcher> > ComponentsSet;
-  ComponentsSet m_components;
+  std::set<shared_ptr<RegexComponentMatcher>> m_components;
   bool m_isInclusion;
 };
 
-
 inline
 RegexComponentSetMatcher::RegexComponentSetMatcher(const std::string& expr,
                                                    shared_ptr<RegexBackrefManager> backrefManager)
-  : RegexMatcher(expr, EXPR_COMPONENT_SET, backrefManager)
+  : RegexMatcher(expr, EXPR_COMPONENT_SET, std::move(backrefManager))
   , m_isInclusion(true)
 {
   compile();
 }
 
-inline
-RegexComponentSetMatcher::~RegexComponentSetMatcher()
-{
-}
-
 inline void
 RegexComponentSetMatcher::compile()
 {
   if (m_expr.size() < 2)
-    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Regexp compile error (cannot parse " +
-                                              m_expr + ")"));
+    BOOST_THROW_EXCEPTION(Error("Regexp compile error (cannot parse " + m_expr + ")"));
 
   switch (m_expr[0]) {
-  case '<':
-    return compileSingleComponent();
-  case '[':
-    {
+    case '<':
+      return compileSingleComponent();
+    case '[': {
       size_t lastIndex = m_expr.size() - 1;
       if (']' != m_expr[lastIndex])
-        BOOST_THROW_EXCEPTION(RegexMatcher::Error("Regexp compile error (no matching ']' in " +
-                                                  m_expr + ")"));
+        BOOST_THROW_EXCEPTION(Error("Regexp compile error (no matching ']' in " + m_expr + ")"));
 
       if ('^' == m_expr[1]) {
         m_isInclusion = false;
@@ -112,9 +97,8 @@
         compileMultipleComponents(1, lastIndex);
       break;
     }
-  default:
-    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Regexp compile error (cannot parse " +
-                                              m_expr + ")"));
+    default:
+      BOOST_THROW_EXCEPTION(Error("Regexp compile error (cannot parse " + m_expr + ")"));
   }
 }
 
@@ -122,18 +106,11 @@
 RegexComponentSetMatcher::compileSingleComponent()
 {
   size_t end = extractComponent(1);
-
   if (m_expr.size() != end)
-    {
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Component expr error " + m_expr));
-    }
-  else
-    {
-      shared_ptr<RegexComponentMatcher> component =
-        make_shared<RegexComponentMatcher>(m_expr.substr(1, end - 2), m_backrefManager);
+    BOOST_THROW_EXCEPTION(Error("Component expr error " + m_expr));
 
-      m_components.insert(component);
-    }
+  m_components.insert(make_shared<RegexComponentMatcher>(m_expr.substr(1, end - 2),
+                                                         m_backrefManager));
 }
 
 inline void
@@ -144,77 +121,62 @@
 
   while (index < lastIndex) {
     if ('<' != m_expr[index])
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Component expr error " + m_expr));
+      BOOST_THROW_EXCEPTION(Error("Component expr error " + m_expr));
 
     tempIndex = index + 1;
     index = extractComponent(tempIndex);
-
-    shared_ptr<RegexComponentMatcher> component =
-      make_shared<RegexComponentMatcher>(m_expr.substr(tempIndex, index - tempIndex - 1),
-                                         m_backrefManager);
-
-    m_components.insert(component);
+    m_components.insert(make_shared<RegexComponentMatcher>(m_expr.substr(tempIndex, index - tempIndex - 1),
+                                                           m_backrefManager));
   }
 
   if (index != lastIndex)
-    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Not sufficient expr to parse " + m_expr));
+    BOOST_THROW_EXCEPTION(Error("Not sufficient expr to parse " + m_expr));
 }
 
 inline bool
 RegexComponentSetMatcher::match(const Name& name, size_t offset, size_t len)
 {
-  bool isMatched = false;
-
-  /* componentset only matches one component */
+  // componentset only matches one component
   if (len != 1)
-    {
-      return false;
-    }
+    return false;
 
-  for (ComponentsSet::iterator it = m_components.begin();
-       it != m_components.end();
-       ++it)
-    {
-      if ((*it)->match(name, offset, len))
-        {
-          isMatched = true;
-          break;
-        }
+  bool isMatched = false;
+  for (const auto& comp : m_components) {
+    if (comp->match(name, offset, len)) {
+      isMatched = true;
+      break;
     }
+  }
 
   m_matchResult.clear();
 
-  if (m_isInclusion ? isMatched : !isMatched)
-    {
-      m_matchResult.push_back(name.get(offset));
-      return true;
-    }
+  if (m_isInclusion ? isMatched : !isMatched) {
+    m_matchResult.push_back(name.get(offset));
+    return true;
+  }
   else
     return false;
 }
 
 inline size_t
-RegexComponentSetMatcher::extractComponent(size_t index)
+RegexComponentSetMatcher::extractComponent(size_t index) const
 {
   size_t lcount = 1;
   size_t rcount = 0;
 
   while (lcount > rcount) {
     switch (m_expr[index]) {
-    case '<':
-      lcount++;
-      break;
-
-    case '>':
-      rcount++;
-      break;
-
-    case 0:
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Error: square brackets mismatch"));
-      break;
+      case '<':
+        lcount++;
+        break;
+      case '>':
+        rcount++;
+        break;
+      case 0:
+        BOOST_THROW_EXCEPTION(Error("Square brackets mismatch"));
+        break;
     }
     index++;
-
   }
 
   return index;
@@ -222,4 +184,4 @@
 
 } // namespace ndn
 
-#endif // NDN_UTIL_REGEX_COMPONENT_SET_MATCHER_HPP
+#endif // NDN_UTIL_REGEX_REGEX_COMPONENT_SET_MATCHER_HPP
diff --git a/src/util/regex/regex-matcher.hpp b/src/util/regex/regex-matcher.hpp
index 9b5d26f..5916565 100644
--- a/src/util/regex/regex-matcher.hpp
+++ b/src/util/regex/regex-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,16 +21,14 @@
  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
-#ifndef NDN_UTIL_REGEX_REGEX_MATCHER_H
-#define NDN_UTIL_REGEX_REGEX_MATCHER_H
+#ifndef NDN_UTIL_REGEX_REGEX_MATCHER_HPP
+#define NDN_UTIL_REGEX_REGEX_MATCHER_HPP
 
-#include "../../common.hpp"
+#include "regex-backref-manager.hpp"
 #include "../../name.hpp"
 
 namespace ndn {
 
-class RegexBackrefManager;
-
 class RegexMatcher
 {
 public:
@@ -54,12 +52,11 @@
     EXPR_PSEUDO
   };
 
-  RegexMatcher(const std::string& expr,
-               const RegexExprType& type,
-               shared_ptr<RegexBackrefManager> backrefManager = shared_ptr<RegexBackrefManager>());
+  RegexMatcher(const std::string& expr, const RegexExprType& type,
+               shared_ptr<RegexBackrefManager> backrefManager = nullptr);
 
   virtual
-  ~RegexMatcher();
+  ~RegexMatcher() = default;
 
   virtual bool
   match(const Name& name, size_t offset, size_t len);
@@ -91,89 +88,65 @@
   bool
   recursiveMatch(size_t matcherNo, const Name& name, size_t offset, size_t len);
 
-
 protected:
   const std::string m_expr;
   const RegexExprType m_type;
   shared_ptr<RegexBackrefManager> m_backrefManager;
-  std::vector<shared_ptr<RegexMatcher> > m_matchers;
+  std::vector<shared_ptr<RegexMatcher>> m_matchers;
   std::vector<name::Component> m_matchResult;
 };
 
 inline std::ostream&
-operator<<(std::ostream& os, const RegexMatcher& regex)
+operator<<(std::ostream& os, const RegexMatcher& rm)
 {
-  os << regex.getExpr();
-  return os;
+  return os << rm.getExpr();
 }
 
-} // namespace ndn
-
-#include "regex-backref-manager.hpp"
-
-namespace ndn {
-
 inline
-RegexMatcher::RegexMatcher(const std::string& expr,
-                           const RegexExprType& type,
+RegexMatcher::RegexMatcher(const std::string& expr, const RegexExprType& type,
                            shared_ptr<RegexBackrefManager> backrefManager)
   : m_expr(expr)
   , m_type(type)
-  , m_backrefManager(backrefManager)
 {
-  if (!static_cast<bool>(m_backrefManager))
+  if (backrefManager)
+    m_backrefManager = std::move(backrefManager);
+  else
     m_backrefManager = make_shared<RegexBackrefManager>();
 }
 
-inline
-RegexMatcher::~RegexMatcher()
-{
-}
-
 inline bool
 RegexMatcher::match(const Name& name, size_t offset, size_t len)
 {
-  bool result = false;
-
   m_matchResult.clear();
 
-  if (recursiveMatch(0, name, offset, len))
-    {
-      for (size_t i = offset; i < offset + len ; i++)
-        m_matchResult.push_back(name.get(i));
-      result = true;
-    }
-  else
-    {
-      result = false;
-    }
+  if (recursiveMatch(0, name, offset, len)) {
+    for (size_t i = offset; i < offset + len; i++)
+      m_matchResult.push_back(name.get(i));
+    return true;
+  }
 
-  return result;
+  return false;
 }
 
 inline bool
 RegexMatcher::recursiveMatch(size_t matcherNo, const Name& name, size_t offset, size_t len)
 {
-  ssize_t tried = len;
-
   if (matcherNo >= m_matchers.size())
-    return (len == 0);
+    return len == 0;
 
-  shared_ptr<RegexMatcher> matcher = m_matchers[matcherNo];
+  ssize_t tried = len;
+  auto matcher = m_matchers[matcherNo];
 
-  while (tried >= 0)
-    {
-      if (matcher->match(name, offset, tried) &&
-          recursiveMatch(matcherNo + 1, name, offset + tried, len - tried))
-        return true;
-      tried--;
-    }
+  while (tried >= 0) {
+    if (matcher->match(name, offset, tried) &&
+        recursiveMatch(matcherNo + 1, name, offset + tried, len - tried))
+      return true;
+    tried--;
+  }
 
   return false;
 }
 
-
 } // namespace ndn
 
-
-#endif // NDN_UTIL_REGEX_REGEX_MATCHER_H
+#endif // NDN_UTIL_REGEX_REGEX_MATCHER_HPP
diff --git a/src/util/regex/regex-pattern-list-matcher.hpp b/src/util/regex/regex-pattern-list-matcher.hpp
index ccac4b8..7bf0366 100644
--- a/src/util/regex/regex-pattern-list-matcher.hpp
+++ b/src/util/regex/regex-pattern-list-matcher.hpp
@@ -24,14 +24,10 @@
 #ifndef NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
 #define NDN_UTIL_REGEX_REGEX_PATTERN_LIST_MATCHER_HPP
 
-#include "../../common.hpp"
-
 #include "regex-matcher.hpp"
 
 namespace ndn {
 
-class RegexBackrefManager;
-
 class RegexPatternListMatcher : public RegexMatcher
 {
 public:
@@ -45,24 +41,24 @@
   bool
   extractPattern(size_t index, size_t* next);
 
-  int
+  size_t
   extractSubPattern(const char left, const char right, size_t index);
 
-  int
+  size_t
   extractRepetition(size_t index);
 };
 
 } // namespace ndn
 
-#include "regex-repeat-matcher.hpp"
 #include "regex-backref-matcher.hpp"
+#include "regex-repeat-matcher.hpp"
 
 namespace ndn {
 
 inline
 RegexPatternListMatcher::RegexPatternListMatcher(const std::string& expr,
                                                  shared_ptr<RegexBackrefManager> backrefManager)
-  : RegexMatcher(expr, EXPR_PATTERN_LIST, backrefManager)
+  : RegexMatcher(expr, EXPR_PATTERN_LIST, std::move(backrefManager))
 {
   compile();
 }
@@ -78,7 +74,7 @@
     subHead = index;
 
     if (!extractPattern(subHead, &index))
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Compile error"));
+      BOOST_THROW_EXCEPTION(Error("Compile error"));
   }
 }
 
@@ -96,12 +92,11 @@
     indicator = index;
     end = extractRepetition(index);
     if (indicator == end) {
-      shared_ptr<RegexMatcher> matcher =
-        make_shared<RegexBackrefMatcher>(m_expr.substr(start, end - start), m_backrefManager);
+      auto matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(start, end - start),
+                                                      m_backrefManager);
       m_backrefManager->pushRef(matcher);
-      dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
-
-      m_matchers.push_back(matcher);
+      matcher->lateCompile();
+      m_matchers.push_back(std::move(matcher));
     }
     else
       m_matchers.push_back(make_shared<RegexRepeatMatcher>(m_expr.substr(start, end - start),
@@ -127,24 +122,22 @@
     break;
 
   default:
-    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Unexpected syntax"));
+    BOOST_THROW_EXCEPTION(Error("Unexpected syntax"));
   }
 
   *next = end;
-
   return true;
 }
 
-inline int
+inline size_t
 RegexPatternListMatcher::extractSubPattern(const char left, const char right, size_t index)
 {
   size_t lcount = 1;
   size_t rcount = 0;
 
   while (lcount > rcount) {
-
     if (index >= m_expr.size())
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Parenthesis mismatch"));
+      BOOST_THROW_EXCEPTION(Error("Parenthesis mismatch"));
 
     if (left == m_expr[index])
       lcount++;
@@ -154,10 +147,11 @@
 
     index++;
   }
+
   return index;
 }
 
-inline int
+inline size_t
 RegexPatternListMatcher::extractRepetition(size_t index)
 {
   size_t exprSize = m_expr.size();
@@ -176,7 +170,7 @@
         break;
     }
     if (index == exprSize)
-      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Missing right brace bracket"));
+      BOOST_THROW_EXCEPTION(Error("Missing right brace bracket"));
     else
       return ++index;
   }
diff --git a/src/util/regex/regex-pseudo-matcher.hpp b/src/util/regex/regex-pseudo-matcher.hpp
index 990840a..a2c19a0 100644
--- a/src/util/regex/regex-pseudo-matcher.hpp
+++ b/src/util/regex/regex-pseudo-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,7 +24,6 @@
 #ifndef NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
 #define NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
 
-#include "../../common.hpp"
 #include "regex-matcher.hpp"
 
 namespace ndn {
@@ -34,21 +33,15 @@
 public:
   RegexPseudoMatcher();
 
-  virtual
-  ~RegexPseudoMatcher()
-  {
-  }
-
-  virtual void
-  compile()
-  {
-  }
-
   void
   setMatchResult(const std::string& str);
 
   void
   resetMatchResult();
+
+protected:
+  void
+  compile() override;
 };
 
 inline
@@ -60,8 +53,7 @@
 inline void
 RegexPseudoMatcher::setMatchResult(const std::string& str)
 {
-  m_matchResult.push_back(name::Component(reinterpret_cast<const uint8_t*>(str.c_str()),
-                                          str.size()));
+  m_matchResult.push_back(name::Component(reinterpret_cast<const uint8_t*>(str.data()), str.size()));
 }
 
 inline void
@@ -70,6 +62,10 @@
   m_matchResult.clear();
 }
 
+inline void
+RegexPseudoMatcher::compile()
+{
+}
 
 } // namespace ndn
 
diff --git a/src/util/regex/regex-repeat-matcher.hpp b/src/util/regex/regex-repeat-matcher.hpp
index 3baaa46..86af906 100644
--- a/src/util/regex/regex-repeat-matcher.hpp
+++ b/src/util/regex/regex-repeat-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,10 +24,6 @@
 #ifndef NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
 #define NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
 
-#include "../../common.hpp"
-
-#include <boost/regex.hpp>
-
 #include "regex-matcher.hpp"
 
 namespace ndn {
@@ -39,29 +35,19 @@
                      shared_ptr<RegexBackrefManager> backrefManager,
                      size_t indicator);
 
-  virtual
-  ~RegexRepeatMatcher()
-  {
-  }
-
-  virtual bool
-  match(const Name& name, size_t offset, size_t len);
+  bool
+  match(const Name& name, size_t offset, size_t len) override;
 
 protected:
-  /**
-   * @brief Compile the regular expression to generate the more matchers when necessary
-   */
-  virtual void
-  compile();
+  void
+  compile() override;
 
 private:
   bool
   parseRepetition();
 
   bool
-  recursiveMatch(size_t repeat,
-                 const Name& name,
-                 size_t offset, size_t len);
+  recursiveMatch(size_t repeat, const Name& name, size_t offset, size_t len);
 
 private:
   size_t m_indicator;
@@ -80,7 +66,7 @@
 RegexRepeatMatcher::RegexRepeatMatcher(const std::string& expr,
                                        shared_ptr<RegexBackrefManager> backrefManager,
                                        size_t indicator)
-  : RegexMatcher(expr, EXPR_REPEAT_PATTERN, backrefManager)
+  : RegexMatcher(expr, EXPR_REPEAT_PATTERN, std::move(backrefManager))
   , m_indicator(indicator)
 {
   compile();
@@ -89,18 +75,16 @@
 inline void
 RegexRepeatMatcher::compile()
 {
-  shared_ptr<RegexMatcher> matcher;
-
   if ('(' == m_expr[0]) {
-    matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(0, m_indicator), m_backrefManager);
+    auto matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(0, m_indicator), m_backrefManager);
     m_backrefManager->pushRef(matcher);
-    dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
+    matcher->lateCompile();
+    m_matchers.push_back(std::move(matcher));
   }
-  else{
-    matcher = make_shared<RegexComponentSetMatcher>(m_expr.substr(0, m_indicator),
-                                                    m_backrefManager);
+  else {
+    m_matchers.push_back(make_shared<RegexComponentSetMatcher>(m_expr.substr(0, m_indicator),
+                                                               m_backrefManager));
   }
-  m_matchers.push_back(matcher);
 
   parseRepetition();
 }
@@ -114,66 +98,65 @@
   if (exprSize == m_indicator) {
     m_repeatMin = 1;
     m_repeatMax = 1;
-
     return true;
   }
-  else {
-    if (exprSize == (m_indicator + 1)) {
-      if ('?' == m_expr[m_indicator]) {
-        m_repeatMin = 0;
-        m_repeatMax = 1;
-        return true;
-      }
-      if ('+' == m_expr[m_indicator]) {
-        m_repeatMin = 1;
-        m_repeatMax = MAX_REPETITIONS;
-        return true;
-      }
-      if ('*' == m_expr[m_indicator]) {
-        m_repeatMin = 0;
-        m_repeatMax = MAX_REPETITIONS;
-        return true;
-      }
+
+  if (exprSize == (m_indicator + 1)) {
+    if ('?' == m_expr[m_indicator]) {
+      m_repeatMin = 0;
+      m_repeatMax = 1;
+      return true;
     }
-    else {
-      std::string repeatStruct = m_expr.substr(m_indicator, exprSize - m_indicator);
-      size_t rsSize = repeatStruct.size();
-      size_t min = 0;
-      size_t max = 0;
-
-      if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,[0-9]+\\}"))) {
-        size_t separator = repeatStruct.find_first_of(',', 0);
-        min = atoi(repeatStruct.substr(1, separator - 1).c_str());
-        max = atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).c_str());
-      }
-      else if (boost::regex_match(repeatStruct, boost::regex("\\{,[0-9]+\\}"))) {
-        size_t separator = repeatStruct.find_first_of(',', 0);
-        min = 0;
-        max = atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).c_str());
-      }
-      else if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,\\}"))) {
-        size_t separator = repeatStruct.find_first_of(',', 0);
-        min = atoi(repeatStruct.substr(1, separator).c_str());
-        max = MAX_REPETITIONS;
-      }
-      else if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+\\}"))) {
-        min = atoi(repeatStruct.substr(1, rsSize - 1).c_str());
-        max = min;
-      }
-      else
-        BOOST_THROW_EXCEPTION(RegexMatcher::Error(std::string("Error: RegexRepeatMatcher.ParseRepetition():")
-                                                  + " Unrecognized format "+ m_expr));
-
-      if (min > MAX_REPETITIONS || max > MAX_REPETITIONS || min > max)
-        BOOST_THROW_EXCEPTION(RegexMatcher::Error(std::string("Error: RegexRepeatMatcher.ParseRepetition():")
-                                                  + " Wrong number " + m_expr));
-
-      m_repeatMin = min;
-      m_repeatMax = max;
-
+    if ('+' == m_expr[m_indicator]) {
+      m_repeatMin = 1;
+      m_repeatMax = MAX_REPETITIONS;
+      return true;
+    }
+    if ('*' == m_expr[m_indicator]) {
+      m_repeatMin = 0;
+      m_repeatMax = MAX_REPETITIONS;
       return true;
     }
   }
+  else {
+    std::string repeatStruct = m_expr.substr(m_indicator, exprSize - m_indicator);
+    size_t rsSize = repeatStruct.size();
+    size_t min = 0;
+    size_t max = 0;
+
+    if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,[0-9]+\\}"))) {
+      size_t separator = repeatStruct.find_first_of(',', 0);
+      min = std::atoi(repeatStruct.substr(1, separator - 1).data());
+      max = std::atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).data());
+    }
+    else if (boost::regex_match(repeatStruct, boost::regex("\\{,[0-9]+\\}"))) {
+      size_t separator = repeatStruct.find_first_of(',', 0);
+      min = 0;
+      max = std::atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).data());
+    }
+    else if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,\\}"))) {
+      size_t separator = repeatStruct.find_first_of(',', 0);
+      min = std::atoi(repeatStruct.substr(1, separator).data());
+      max = MAX_REPETITIONS;
+    }
+    else if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+\\}"))) {
+      min = std::atoi(repeatStruct.substr(1, rsSize - 1).data());
+      max = min;
+    }
+    else
+      BOOST_THROW_EXCEPTION(Error(std::string("Error: RegexRepeatMatcher.ParseRepetition():")
+                                  + " Unrecognized format " + m_expr));
+
+    if (min > MAX_REPETITIONS || max > MAX_REPETITIONS || min > max)
+      BOOST_THROW_EXCEPTION(Error(std::string("Error: RegexRepeatMatcher.ParseRepetition():")
+                                  + " Wrong number " + m_expr));
+
+    m_repeatMin = min;
+    m_repeatMax = max;
+
+    return true;
+  }
+
   return false;
 }
 
@@ -182,53 +165,47 @@
 {
   m_matchResult.clear();
 
-  if (0 == m_repeatMin)
-    if (0 == len)
+  if (m_repeatMin == 0)
+    if (len == 0)
       return true;
 
-  if (recursiveMatch(0, name, offset, len))
-    {
-      for (size_t i = offset; i < offset + len; i++)
-        m_matchResult.push_back(name.get(i));
-      return true;
-    }
-  else
-    return false;
+  if (recursiveMatch(0, name, offset, len)) {
+    for (size_t i = offset; i < offset + len; i++)
+      m_matchResult.push_back(name.get(i));
+    return true;
+  }
+
+  return false;
 }
 
 inline bool
 RegexRepeatMatcher::recursiveMatch(size_t repeat, const Name& name, size_t offset, size_t len)
 {
   ssize_t tried = len;
-  shared_ptr<RegexMatcher> matcher = m_matchers[0];
 
-  if (0 < len && repeat >= m_repeatMax)
-    {
-      return false;
-    }
+  if (0 < len && repeat >= m_repeatMax) {
+    return false;
+  }
 
-  if (0 == len && repeat < m_repeatMin)
-    {
-      return false;
-    }
+  if (0 == len && repeat < m_repeatMin) {
+    return false;
+  }
 
-  if (0 == len && repeat >= m_repeatMin)
-    {
+  if (0 == len && repeat >= m_repeatMin) {
+    return true;
+  }
+
+  auto matcher = m_matchers[0];
+  while (tried >= 0) {
+    if (matcher->match(name, offset, tried) &&
+        recursiveMatch(repeat + 1, name, offset + tried, len - tried))
       return true;
-    }
-
-  while (tried >= 0)
-    {
-      if (matcher->match(name, offset, tried) &&
-          recursiveMatch(repeat + 1, name, offset + tried, len - tried))
-        return true;
-      tried--;
-    }
+    tried--;
+  }
 
   return false;
 }
 
-
 } // namespace ndn
 
 #endif // NDN_UTIL_REGEX_REGEX_REPEAT_MATCHER_HPP
diff --git a/src/util/regex/regex-top-matcher.cpp b/src/util/regex/regex-top-matcher.cpp
index d9ff669..0c2ac9a 100644
--- a/src/util/regex/regex-top-matcher.cpp
+++ b/src/util/regex/regex-top-matcher.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -40,15 +40,9 @@
   compile();
 }
 
-RegexTopMatcher::~RegexTopMatcher()
-{
-}
-
 void
 RegexTopMatcher::compile()
 {
-  std::string errMsg = "Error: RegexTopMatcher.Compile(): ";
-
   std::string expr = m_expr;
 
   if ('$' != expr[expr.size() - 1])
@@ -57,18 +51,14 @@
     expr = expr.substr(0, expr.size() - 1);
 
   if ('^' != expr[0]) {
-    m_secondaryMatcher = make_shared<RegexPatternListMatcher>(
-      "<.*>*" + expr,
-      m_secondaryBackrefManager);
+    m_secondaryMatcher = make_shared<RegexPatternListMatcher>("<.*>*" + expr,
+                                                              m_secondaryBackrefManager);
   }
   else {
     expr = expr.substr(1, expr.size() - 1);
   }
 
-  // On OSX 10.9, boost, and C++03 the following doesn't work without ndn::
-  // because the argument-dependent lookup prefers STL to boost
-  m_primaryMatcher = ndn::make_shared<RegexPatternListMatcher>(expr,
-                                                               m_primaryBackrefManager);
+  m_primaryMatcher = make_shared<RegexPatternListMatcher>(expr, m_primaryBackrefManager);
 }
 
 bool
@@ -78,21 +68,18 @@
 
   m_matchResult.clear();
 
-  if (m_primaryMatcher->match(name, 0, name.size()))
-    {
-      m_matchResult = m_primaryMatcher->getMatchResult();
+  if (m_primaryMatcher->match(name, 0, name.size())) {
+    m_matchResult = m_primaryMatcher->getMatchResult();
+    return true;
+  }
+  else {
+    if (m_secondaryMatcher != nullptr && m_secondaryMatcher->match(name, 0, name.size())) {
+      m_matchResult = m_secondaryMatcher->getMatchResult();
+      m_isSecondaryUsed = true;
       return true;
     }
-  else
-    {
-      if (static_cast<bool>(m_secondaryMatcher) && m_secondaryMatcher->match(name, 0, name.size()))
-        {
-          m_matchResult = m_secondaryMatcher->getMatchResult();
-          m_isSecondaryUsed = true;
-          return true;
-        }
-      return false;
-    }
+    return false;
+  }
 }
 
 bool
@@ -104,51 +91,37 @@
 Name
 RegexTopMatcher::expand(const std::string& expandStr)
 {
-  Name result;
-
-  shared_ptr<RegexBackrefManager> backrefManager =
-    (m_isSecondaryUsed ? m_secondaryBackrefManager : m_primaryBackrefManager);
-
+  auto backrefManager = m_isSecondaryUsed ? m_secondaryBackrefManager : m_primaryBackrefManager;
   size_t backrefNo = backrefManager->size();
 
   std::string expand;
-
   if (!expandStr.empty())
     expand = expandStr;
   else
     expand = m_expand;
 
+  Name result;
   size_t offset = 0;
-  while (offset < expand.size())
-    {
-      std::string item = getItemFromExpand(expand, offset);
-      if (item[0] == '<')
-        {
-          result.append(item.substr(1, item.size() - 2));
-        }
-      if (item[0] == '\\')
-        {
-          size_t index = boost::lexical_cast<size_t>(item.substr(1, item.size() - 1));
-
-          if (0 == index) {
-            std::vector<name::Component>::iterator it = m_matchResult.begin();
-            std::vector<name::Component>::iterator end = m_matchResult.end();
-            for (; it != end; it++)
-              result.append(*it);
-          }
-          else if (index <= backrefNo)
-            {
-              std::vector<name::Component>::const_iterator it =
-                backrefManager->getBackref(index - 1)->getMatchResult().begin();
-              std::vector<name::Component>::const_iterator end =
-                backrefManager->getBackref(index - 1)->getMatchResult().end();
-              for (; it != end; it++)
-                result.append(*it);
-            }
-          else
-            BOOST_THROW_EXCEPTION(RegexMatcher::Error("Exceed the range of back reference"));
-        }
+  while (offset < expand.size()) {
+    std::string item = getItemFromExpand(expand, offset);
+    if (item[0] == '<') {
+      result.append(item.substr(1, item.size() - 2));
     }
+    if (item[0] == '\\') {
+      size_t index = boost::lexical_cast<size_t>(item.substr(1, item.size() - 1));
+      if (index == 0) {
+        for (const auto& i : m_matchResult)
+          result.append(i);
+      }
+      else if (index <= backrefNo) {
+        for (const auto& i : backrefManager->getBackref(index - 1)->getMatchResult())
+          result.append(i);
+      }
+      else
+        BOOST_THROW_EXCEPTION(Error("Exceed the range of back reference"));
+    }
+  }
+
   return result;
 }
 
@@ -157,44 +130,41 @@
 {
   size_t begin = offset;
 
-  if (expand[offset] == '\\')
-    {
-      offset++;
-      if (offset >= expand.size())
-        BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
+  if (expand[offset] == '\\') {
+    offset++;
+    if (offset >= expand.size())
+      BOOST_THROW_EXCEPTION(Error("Wrong format of expand string"));
 
-      while (expand[offset] <= '9' and expand[offset] >= '0') {
-        offset++;
-        if (offset > expand.size())
-          BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
-      }
-      if (offset > begin + 1)
-        return expand.substr(begin, offset - begin);
-      else
-        BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
+    while (expand[offset] <= '9' and expand[offset] >= '0') {
+      offset++;
+      if (offset > expand.size())
+        BOOST_THROW_EXCEPTION(Error("Wrong format of expand string"));
     }
-  else if (expand[offset] == '<')
-    {
-      offset++;
-      if (offset >= expand.size())
-        BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
-
-      size_t left = 1;
-      size_t right = 0;
-      while (right < left)
-        {
-          if (expand[offset] == '<')
-            left++;
-          if (expand[offset] == '>')
-            right++;
-          offset++;
-          if (offset >= expand.size())
-            BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
-        }
+    if (offset > begin + 1)
       return expand.substr(begin, offset - begin);
+    else
+      BOOST_THROW_EXCEPTION(Error("Wrong format of expand string"));
+  }
+  else if (expand[offset] == '<') {
+    offset++;
+    if (offset >= expand.size())
+      BOOST_THROW_EXCEPTION(Error("Wrong format of expand string"));
+
+    size_t left = 1;
+    size_t right = 0;
+    while (right < left) {
+      if (expand[offset] == '<')
+        left++;
+      if (expand[offset] == '>')
+        right++;
+      offset++;
+      if (offset >= expand.size())
+        BOOST_THROW_EXCEPTION(Error("Wrong format of expand string"));
     }
+    return expand.substr(begin, offset - begin);
+  }
   else
-    BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
+    BOOST_THROW_EXCEPTION(Error("Wrong format of expand string"));
 }
 
 shared_ptr<RegexTopMatcher>
@@ -202,50 +172,46 @@
 {
   std::string regexStr("^");
 
-  for (Name::const_iterator it = name.begin(); it != name.end(); it++)
-    {
-      regexStr.append("<");
-      regexStr.append(convertSpecialChar(it->toUri()));
-      regexStr.append(">");
-    }
+  for (auto it = name.begin(); it != name.end(); it++) {
+    regexStr.append("<");
+    regexStr.append(convertSpecialChar(it->toUri()));
+    regexStr.append(">");
+  }
 
   if (hasAnchor)
     regexStr.append("$");
 
-  // On OSX 10.9, boost, and C++03 the following doesn't work without ndn::
-  // because the argument-dependent lookup prefers STL to boost
-  return ndn::make_shared<RegexTopMatcher>(regexStr);
+  return make_shared<RegexTopMatcher>(regexStr);
 }
 
 std::string
 RegexTopMatcher::convertSpecialChar(const std::string& str)
 {
   std::string newStr;
-  for (size_t i = 0; i < str.size(); i++)
-    {
-      char c = str[i];
-      switch (c)
-        {
-        case '.':
-        case '[':
-        case '{':
-        case '}':
-        case '(':
-        case ')':
-        case '\\':
-        case '*':
-        case '+':
-        case '?':
-        case '|':
-        case '^':
-        case '$':
-          newStr.push_back('\\');
-          // Fallthrough
-        default:
-          newStr.push_back(c);
-          break;
-        }
+
+  for (size_t i = 0; i < str.size(); i++) {
+    char c = str[i];
+    switch (c) {
+      case '.':
+      case '[':
+      case '{':
+      case '}':
+      case '(':
+      case ')':
+      case '\\':
+      case '*':
+      case '+':
+      case '?':
+      case '|':
+      case '^':
+      case '$':
+        newStr.push_back('\\');
+        NDN_CXX_FALLTHROUGH;
+      default:
+        newStr.push_back(c);
+        break;
     }
+  }
 
   return newStr;
 }
diff --git a/src/util/regex/regex-top-matcher.hpp b/src/util/regex/regex-top-matcher.hpp
index 777a4de..a60e758 100644
--- a/src/util/regex/regex-top-matcher.hpp
+++ b/src/util/regex/regex-top-matcher.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,8 +24,6 @@
 #ifndef NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
 #define NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
 
-#include "../../common.hpp"
-
 #include "regex-matcher.hpp"
 
 namespace ndn {
@@ -33,32 +31,30 @@
 class RegexPatternListMatcher;
 class RegexBackrefManager;
 
-class RegexTopMatcher: public RegexMatcher
+class RegexTopMatcher : public RegexMatcher
 {
 public:
+  explicit
   RegexTopMatcher(const std::string& expr, const std::string& expand = "");
 
-  virtual
-  ~RegexTopMatcher();
-
   bool
   match(const Name& name);
 
-  virtual bool
-  match(const Name& name, size_t offset, size_t len);
+  bool
+  match(const Name& name, size_t offset, size_t len) override;
 
   virtual Name
   expand(const std::string& expand = "");
 
   static shared_ptr<RegexTopMatcher>
-  fromName(const Name& name, bool hasAnchor=false);
+  fromName(const Name& name, bool hasAnchor = false);
 
 protected:
-  virtual void
-  compile();
+  void
+  compile() override;
 
 private:
-  std::string
+  static std::string
   getItemFromExpand(const std::string& expand, size_t& offset);
 
   static std::string
