

class UrlExtractor:
    '''
    convert pattern to group match re, re.sub
    match => self.named_re march
    extract => group match to dict
    '''
    def __init__(self, pattern):
        pass

    def match(self, url):
        pass

    def extract(self, url):
        pass

@@ -1,8 +1,18 @@
+import re%0A
 %0A%0Aclass 
@@ -185,16 +185,21 @@
  pattern
+: str
 ):%0A     
@@ -205,91 +205,458 @@
     
-pass%0A%0A    def match(self, url):%0A        pass%0A%0A    def extract(self, url):%0A        pass
+self._pattern = pattern%0A        self._meta_pattern = self._parse_pattern()%0A%0A    def _parse_pattern(self):%0A        meta_pattern = re.sub('%7B(%5B%5Cw_%5D+)%7D', r'(?P%3C%5C1%3E%5B%5Cw_%5D+)', self._pattern)%0A        return re.compile(meta_pattern)%0A%0A    def match(self, url):%0A        return self._meta_pattern.fullmatch(url)%0A%0A    def extract(self, url):%0A        matched = self._meta_pattern.match(url)%0A        if matched:%0A            return matched.groupdict()%0A        return %7B%7D
 %0A

add url extractor simple implementation