Regex_search ignorecase not working

Morning all,

I’m having some issues with the following automation…

  - alias: Completed Star Trek Download
    trigger:
      platform: event
      event_type: nzbget_download_complete
      event_data:
        category: tv
    #condition:
    #  condition: template
    #  value_template: '{% if trigger.event.data.name | regex_search("star.trek", ignorecase=TRUE) %}TRUE{% endif %}'
    action:
      service: notify.email_kyle
      data_template:
        title: "Star Trek download completed!"
        message: "{{ trigger.event.data.name }} {{ trigger.event.data.name | regex_search('star.trek', ignorecase=TRUE) }}"

When I feed nzbget_download_complete a test event, in the form of name: 'star trek' it understandably comes back true, but when I put a capital in it anywhere I get false, even though ignorecase=true is supplied

What am I doing wrong?

ignorecase=True

True != TRUE

Perfect, thank you. It’s been that all along.

I blame it on the example at https://www.home-assistant.io/docs/configuration/templating/ where it has FALSE all the time! :slight_smile:

Good point! That is a bug in the documentation :slight_smile:

I’ll get a PR put in shortly!

1 Like