How to find some text in a string using Homey script?

I am looking for a solution to find a specific value which is stored in a logic value text string.

My logic value text string is name: film_zenders and it contains a list of film channels:
‘Film sky_cinema play_more amc_hd axn_white great!_action great!_romance great!_movies hollywoodhd M+ tmc_hd’

An other logic value contains the current channel name of my TV box, for example: ‘Film1_action’, there are never any spaces in the channel name.

I tried to use logic cards to check if there is a partial match between the 2 string, but sadly the logic cards have no preg_match or regex functionality.

No I hope Homey script can do this.

Does someone know how i can get this to work:
So i am looking for code which does the following:

  • read the logic value ‘film_zenders’
  • read the logic value ‘tv_channel’
  • compare if ‘tv_channel’ has a partial match in ‘tv_zenders’ list
  • If there is a match return true otherwise return false

So when ‘tv_channel’ has the name ‘sky_cinema_action’ in it should return true, but when it contains ‘sbs6’ it should return false as result