def regex(text, pattern):
  if text[:4].lower() == 'http':
    text = requests.get(text).text
  match = re.search(pattern, text, re.S | re.I)
  if match:
    if "scrape" in match.groupdict().keys():
      return match.group("scrape")
  else:
    return None
Take text and a Regular Expression using a group named scrape, and return match.
dataset/ETHPy150Open miklevin/pipulate/common.py/regex