Jinja2 regular expression template filter!

We so very badly need regex support in the jinja2 filters. Ansible has a similar jinja2 filter called regex_search I believe. This would save a lot of headaches when trying to parse strings. Currently we have to resort to weird solutions like:

{%set thing = states['input_boolean']['door_keypad_10_4th_bedroom_switch'].object_id%}
{% set ident = "_".join(thing.split("_")[3:-1]) %}

just to get at the substring 4th_bedroom!

Don’t forget to upvote this if you too want the feature!

Please please please…

Hi have we solved this problem? Thanks.

The only way I know to do this as of now is to use command-line sensors.