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

**URL:** <https://community.homey.app/t/how-to-find-some-text-in-a-string-using-homey-script/75096>\
**Category:** Developers\
**Created:** [January 14, 2023, 8:26pm UTC](https://community.homey.app/t/how-to-find-some-text-in-a-string-using-homey-script/75096 "2023-01-14T20:26:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![B3rt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/b3rt/32/9435_2.png) [@B3rt](https://community.homey.app/u/B3rt)\
**Post date:** [January 14, 2023, 8:26pm UTC](https://community.homey.app/t/how-to-find-some-text-in-a-string-using-homey-script/75096/1 "2023-01-14T20:26:25Z")

</div>

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
