import re
from .filter import Filter


class Regex(Filter):

    """ Matches filenames with the given regular expression

        Inputs:
            expr [str]  The regular expression to be matched

        Outputs:
            None
    """

    def __init__(self, expr):
        self.expr = re.compile(expr)

    def matches(self, path):
        return self.expr.match(path.name)

    def parse(self, path):
        return self.expr.match(path.name).groupdict()

@@ -61,16 +61,20 @@
 %0A    %22%22%22
+%0A   
  Matches
@@ -127,42 +127,31 @@
     
-    Inputs:%0A            expr %5Bstr%5D
+:param str expr:%0A      
   Th
@@ -188,43 +188,8 @@
 ched
-%0A%0A        Outputs:%0A            None
 %0A   
@@ -353,32 +353,68 @@
 se(self, path):%0A
+        # TODO: regex.xyz namespace%0A
         return s

update docs