code: def _filter_by_regex(self, regex, text, group=1):
          
          match = re.search(
              regex,
              text,
              re.MULTILINE
          )
  
          return match.group(group).strip() if (
              match and match.groups()
          ) else text
docs: Filter @text by @regex.