diff --git a/src/util/regex/regex-component-set-matcher.hpp b/src/util/regex/regex-component-set-matcher.hpp
index 9c2ff16..7d250f0 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-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -17,8 +17,6 @@
  * <http://www.gnu.org/licenses/>.
  *
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
  */
 
 #ifndef NDN_UTIL_REGEX_COMPONENT_SET_MATCHER_HPP
@@ -44,10 +42,10 @@
   RegexComponentSetMatcher(const std::string& expr, shared_ptr<RegexBackrefManager> backrefManager);
 
   virtual
-  ~RegexComponentSetMatcher();
+  ~RegexComponentSetMatcher() NDN_CXX_DECL_FINAL;
 
   virtual bool
-  match(const Name& name, size_t offset, size_t len = 1);
+  match(const Name& name, size_t offset, size_t len = 1) NDN_CXX_DECL_FINAL;
 
 protected:
   /**
@@ -55,7 +53,7 @@
    * @returns true if compiling succeeds
    */
   virtual void
-  compile();
+  compile() NDN_CXX_DECL_FINAL;
 
 private:
   size_t
@@ -73,151 +71,6 @@
   bool m_isInclusion;
 };
 
-
-inline
-RegexComponentSetMatcher::RegexComponentSetMatcher(const std::string& expr,
-                                                   shared_ptr<RegexBackrefManager> backrefManager)
-  : RegexMatcher(expr, EXPR_COMPONENT_SET, backrefManager)
-  , m_isInclusion(true)
-{
-  compile();
-}
-
-inline
-RegexComponentSetMatcher::~RegexComponentSetMatcher()
-{
-}
-
-inline void
-RegexComponentSetMatcher::compile()
-{
-  if (m_expr.size() < 2)
-    throw RegexMatcher::Error("Regexp compile error (cannot parse " + m_expr + ")");
-
-  switch (m_expr[0]) {
-  case '<':
-    return compileSingleComponent();
-  case '[':
-    {
-      size_t lastIndex = m_expr.size() - 1;
-      if (']' != m_expr[lastIndex])
-        throw RegexMatcher::Error("Regexp compile error (no matching ']' in " + m_expr + ")");
-
-      if ('^' == m_expr[1]) {
-        m_isInclusion = false;
-        compileMultipleComponents(2, lastIndex);
-      }
-      else
-        compileMultipleComponents(1, lastIndex);
-      break;
-    }
-  default:
-    throw RegexMatcher::Error("Regexp compile error (cannot parse " + m_expr + ")");
-  }
-}
-
-inline void
-RegexComponentSetMatcher::compileSingleComponent()
-{
-  size_t end = extractComponent(1);
-
-  if (m_expr.size() != end)
-    {
-      throw RegexMatcher::Error("Component expr error " + m_expr);
-    }
-  else
-    {
-      shared_ptr<RegexComponentMatcher> component =
-        make_shared<RegexComponentMatcher>(m_expr.substr(1, end - 2), m_backrefManager);
-
-      m_components.insert(component);
-    }
-}
-
-inline void
-RegexComponentSetMatcher::compileMultipleComponents(size_t start, size_t lastIndex)
-{
-  size_t index = start;
-  size_t tempIndex = start;
-
-  while (index < lastIndex) {
-    if ('<' != m_expr[index])
-      throw RegexMatcher::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);
-  }
-
-  if (index != lastIndex)
-    throw RegexMatcher::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 */
-  if (len != 1)
-    {
-      return false;
-    }
-
-  for (ComponentsSet::iterator it = m_components.begin();
-       it != m_components.end();
-       ++it)
-    {
-      if ((*it)->match(name, offset, len))
-        {
-          isMatched = true;
-          break;
-        }
-    }
-
-  m_matchResult.clear();
-
-  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)
-{
-  size_t lcount = 1;
-  size_t rcount = 0;
-
-  while (lcount > rcount) {
-    switch (m_expr[index]) {
-    case '<':
-      lcount++;
-      break;
-
-    case '>':
-      rcount++;
-      break;
-
-    case 0:
-      throw RegexMatcher::Error("Error: square brackets mismatch");
-      break;
-    }
-    index++;
-
-  }
-
-  return index;
-}
-
 } // namespace ndn
 
 #endif // NDN_UTIL_REGEX_COMPONENT_SET_MATCHER_HPP
