Does Homey/Homeyscript not support regex?

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 # Sitemaps Sitemap: https://website.dk/sitemap.xml

Homeyscript

const regex = /Disallow:/;

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

image

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

Get rid of the console.log

1 Like

Check this script

1 Like

OMG! Thanks!

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

1 Like