# Does Homey/Homeyscript not support regex?

**URL:** <https://community.homey.app/t/does-homey-homeyscript-not-support-regex/110491>\
**Category:** Questions & Help\
**Tags:** homeyscript, homey-pro\
**Created:** [May 25, 2024, 9:04pm UTC](https://community.homey.app/t/does-homey-homeyscript-not-support-regex/110491 "2024-05-25T21:04:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esben](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/esben/32/79405_2.png) [@Esben](https://community.homey.app/u/Esben)\
**Post date:** [May 25, 2024, 9:04pm UTC](https://community.homey.app/t/does-homey-homeyscript-not-support-regex/110491/1 "2024-05-25T21:04:03Z")

</div>

Hi folks

I am trying to validate whether a text string contains a very specific combination of words and characters.

After some hours of trying to get homeyscript to do the pattern matching using regex I am about to give up.

I have reduced my string pattern to the absolute simple variant seen below (just “Disallow:”) - and still the homeyscript returns false.

Demo variable = User-agent: \* Disallow: / # Host Host: [https://website.dk](https://website.dk) # Sitemaps Sitemap: [https://website.dk/sitemap.xml](https://website.dk/sitemap.xml)

Homeyscript

```auto
const regex = /Disallow:/;

    // Test the input string against the regular expression
    return regex.test(console.log(args[0]));

```

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/b/5b0fb039d6811b92ecf562f35ccf77d56baac481.png)

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/7/07440abecc30752c9670efd76eea724d7bc33166.png)

If Homey/homeyscript does not support regex pattern matching, which kinds of pattern matching methods can I use instead?

---

<div class="post-metadata">

**Author:** ![staeff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/staeff/32/79712_2.png) [@staeff](https://community.homey.app/u/staeff)\
**Post date:** [May 26, 2024, 1:14am UTC](https://community.homey.app/t/does-homey-homeyscript-not-support-regex/110491/2 "2024-05-26T01:14:53Z")

</div>

Get rid of the console.log

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [May 26, 2024, 2:34am UTC](https://community.homey.app/t/does-homey-homeyscript-not-support-regex/110491/3 "2024-05-26T02:34:35Z")

</div>

Check this script

> [@A script to check sensor last update](https://community.homey.app/t/a-script-to-check-sensor-last-update/63142/39):
>
> As there is for some time options to see Lastseen timestamp for Zigbee devices, here is the script for Zigbee devices only, which might be more accurate for Zigbee devices. Thanks @Caseda for your overview script wink Version 0.3 - updated for HomeyScript v. 3.5.1 Version 0.3b - fixed for THEN card (returning TEXT value), primary use-better use is for AND card though Version 0.4 - added option to filter out routers and/or end devices // Version 0.4 // Script checks LastSeen property of Zig…

---

<div class="post-metadata">

**Author:** ![Esben](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/esben/32/79405_2.png) [@Esben](https://community.homey.app/u/Esben)\
**Post date:** [May 26, 2024, 7:09am UTC](https://community.homey.app/t/does-homey-homeyscript-not-support-regex/110491/4 "2024-05-26T07:09:15Z")

</div>

OMG! Thanks!

I had been testing different solutions and added the console.log at some point - and completely missed it.
