How to make a template to check for example if string FF:FF:10:E3:B7:C2 (Selfie) or word “Selfie” exists in this attribute - give true, else give false.
Then it means the value is not a string but a list (and the value sample you posted was misleading).
The fact it worked only when you supplied the full MAC address with “(Selfie)” confirms it’s a list.
Here’s the optimal way to search for a partial string within a list.
{{ state_attr('sensor.s24ultra_bluetooth_connection', 'paired_devices') is search('Selfie') }}
If you want to learn more about it, copy-paste the following example into the Template Editor and observe the results.
Partial string in a string (True).
{{ 'Selfie' in 'bla, bla, bla Selfie, blabla' }}
Partial string in a list (False).
{{ 'Selfie' in ['bla', 'bla', 'bla Selfie', 'blabla'] }}
Complete string in a list (True).
{{ 'bla Selfie' in ['bla', 'bla', 'bla Selfie', 'blabla'] }}
Partial string in a list (True).
{{ ['bla', 'bla', 'bla Selfie', 'blabla'] is search('Selfie') }}