Is there a way to use regex to modify strings in templates?

I’m using {{trigger.entity_id}} which returns sensor.bmw. I’d like to be able to strip the “sensor.” part so I’m just left with “bmw”. Is there a way to do this?

You don’t need regex for this. Just split the string at the point

{{ trigger.entity_id.split('.') }}

and use the second value

{{ trigger.entity_id.split('.')[1] }}