diff --git a/src/util/regex/regex-matcher.hpp b/src/util/regex/regex-matcher.hpp
index 0d34311..d62ab41 100644
--- a/src/util/regex/regex-matcher.hpp
+++ b/src/util/regex/regex-matcher.hpp
@@ -18,7 +18,15 @@
 class RegexMatcher
 {
 public:
-  struct Error : public std::runtime_error { Error(const std::string& what) : std::runtime_error(what) {} };
+  class Error : public std::runtime_error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : std::runtime_error(what)
+    {
+    }
+  };
 
   enum RegexExprType{
     EXPR_TOP,
@@ -26,52 +34,52 @@
     EXPR_PATTERNLIST,
 
     EXPR_REPEAT_PATTERN,
-      
+
     EXPR_BACKREF,
     EXPR_COMPONENT_SET,
     EXPR_COMPONENT,
 
     EXPR_PSEUDO
-  };    
+  };
 
-  RegexMatcher(const std::string& expr, 
-               const RegexExprType& type,  
+  RegexMatcher(const std::string& expr,
+               const RegexExprType& type,
                shared_ptr<RegexBackrefManager> backrefManager = shared_ptr<RegexBackrefManager>());
 
-  virtual 
+  virtual
   ~RegexMatcher();
 
-  virtual bool 
+  virtual bool
   match(const Name& name, const int& offset, const int& len);
 
   /**
    * @brief get the matched name components
    * @returns the matched name components
    */
-  const std::vector<name::Component>& 
+  const std::vector<name::Component>&
   getMatchResult() const
   { return m_matchResult; }
 
   const std::string&
   getExpr() const
-  { return m_expr; } 
+  { return m_expr; }
 
 protected:
   /**
    * @brief Compile the regular expression to generate the more matchers when necessary
    * @returns true if compiling succeeds
    */
-  virtual void 
+  virtual void
   compile() = 0;
 
 private:
-  bool 
+  bool
   recursiveMatch(size_t mId, const Name& name, size_t offset, size_t len);
 
 
 protected:
   const std::string m_expr;
-  const RegexExprType m_type; 
+  const RegexExprType m_type;
   shared_ptr<RegexBackrefManager> m_backrefManager;
   std::vector<shared_ptr<RegexMatcher> > m_matcherList;
   std::vector<name::Component> m_matchResult;
@@ -84,14 +92,14 @@
 namespace ndn {
 
 inline
-RegexMatcher::RegexMatcher(const std::string& expr, 
-                           const RegexExprType& type,  
-                           shared_ptr<RegexBackrefManager> backrefManager) 
-  : m_expr(expr), 
+RegexMatcher::RegexMatcher(const std::string& expr,
+                           const RegexExprType& type,
+                           shared_ptr<RegexBackrefManager> backrefManager)
+  : m_expr(expr),
     m_type(type),
     m_backrefManager(backrefManager)
 {
-  if(NULL == m_backrefManager)
+  if (NULL == m_backrefManager)
     m_backrefManager = make_shared<RegexBackrefManager>();
 }
 
@@ -100,7 +108,7 @@
 {
 }
 
-inline bool 
+inline bool
 RegexMatcher::match (const Name& name, const int& offset, const int& len)
 {
   // _LOG_TRACE ("Enter RegexMatcher::match");
@@ -108,7 +116,7 @@
 
   m_matchResult.clear();
 
-  if(recursiveMatch(0, name, offset, len))
+  if (recursiveMatch(0, name, offset, len))
     {
       for(int i = offset; i < offset + len ; i++)
         m_matchResult.push_back(name.get(i));
@@ -122,23 +130,23 @@
   // _LOG_TRACE ("Exit RegexMatcher::match");
   return result;
 }
-  
-inline bool 
+
+inline bool
 RegexMatcher::recursiveMatch(size_t mId, const Name& name, size_t offset, size_t len)
 {
   // _LOG_TRACE ("Enter RegexMatcher::recursiveMatch");
 
   int tried = len;
 
-  if(mId >= m_matcherList.size())
+  if (mId >= m_matcherList.size())
     return (len != 0 ? false : true);
-    
+
   shared_ptr<RegexMatcher> matcher = m_matcherList[mId];
 
   while(tried >= 0)
     {
-      if(matcher->match(name, offset, tried) && recursiveMatch(mId + 1, name, offset + tried, len - tried))
-        return true;      
+      if (matcher->match(name, offset, tried) && recursiveMatch(mId + 1, name, offset + tried, len - tried))
+        return true;
       tried--;
     }
 
