code: def _regex_to_static(src, regex):
      '''
      Expand regular expression to static match.
      '''
      if not src or not regex:
          return None
  
      try:
          compiled = re.compile(regex, re.DOTALL)
          src = [line for line in src if compiled.search(line) or line.count(regex)]
      except Exception as ex:
          raise CommandExecutionError("{0}: '{1}'".format(_get_error_message(ex), regex))
  
      return src and src or [f _regex_to_static(src, regex):
      '''
      Expand regular expression to static match.
      '''
      if not src or not regex:
          return None
  
      try:
          compiled = re.compile(regex, re.DOTALL)
          src = [line for line in src if compiled.search(line) or line.count(regex)]
      except Exception as ex:
          raise CommandExecutionError("{0}: '{1}'".format(_get_error_message(ex), regex))
  
      return src and src or []
docs: Expand regular expression to static match.