code: def regex_match(txt, rgx, ignorecase=False, multiline=False):
      '''
      Searches for a pattern in the text.
  
      .. code-block:: jinja
  
          {% set my_text = 'abcd' %}
          {{ my_text | regex_match('^(.*)BC(.*)$', ignorecase=True) }}
  
      will be rendered as:
  
      .. code-block:: text
  
          ('a', 'd')
      '''
      flag = 0
      if ignorecase:
          flag |= re.I
      if multiline:
          flag |= re.M
      obj = re.match(rgx, txt, flag)
      if not obj:
          return
      return obj.groups(f regex_match(txt, rgx, ignorecase=False, multiline=False):
      '''
      Searches for a pattern in the text.
  
      .. code-block:: jinja
  
          {% set my_text = 'abcd' %}
          {{ my_text | regex_match('^(.*)BC(.*)$', ignorecase=True) }}
  
      will be rendered as:
  
      .. code-block:: text
  
          ('a', 'd')
      '''
      flag = 0
      if ignorecase:
          flag |= re.I
      if multiline:
          flag |= re.M
      obj = re.match(rgx, txt, flag)
      if not obj:
          return
      return obj.groups()
docs: Searches for a pattern in the text.
  
      .. code-block:: jinja
  
          {% set my_text = 'abcd' %}
          {{ my_text | regex_match('^(.*)BC(.*)$', ignorecase=True) }}
  
      will be rendered as:
  
      .. code-block:: text
  
          ('a', 'd')