Templeting, reject by regex?

I’m completely new to the templating, I can’t find any documentation on reject(), except https://jinja.palletsprojects.com/en/master/templates/#reject which doesn’t help.

How can I use a regex to reject by pattern on a list? A simple test:

{%
set list =['media_player.plex_1',
           'media_player.plex_2',
           'media_player.plex_3',
           'not_filtered',
     ]
%}

{{list|reject('in', ['media_player.plex_*'])|list}}

It shows:

['media_player.plex_1', 'media_player.plex_2', 'media_player.plex_3', 'not_filtered']

:confused:


I’m looking for a method to simplify an unavailable_entities list I found on the forums a while back. My dilemma are plex_ entities: they can be dozens or none. My “entity_blacklist” is getting a little large (and annoying). It would be so much simpler if I can just filter out all media_player.plex_* entities.