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
