Valid regex expression not working in set mode

Hello, I’m in the process of creating a workflow with the N8N desktop app (on a Macbook Air M1), and I’m trying to use the “set” node to extract URL’s from a string, but it’s not working, even though the regex expression is valid, as you can see in this screenshot:

Here’s the code for the node:

I know that the expression is valid, as it’s working in this “IF” node:

Any ideas of why this is happening and how to fix it? Thanks!

So I think this might be a problem with the syntax of .match(). To specify a regular expression you’d need to wrap it in slashes (like /yourRegularExpressionGoesHere/) and then append any modifiers after the last slash (like /yourRegularExpressionGoesHere/i.

So I think your expression would need to look like this:

{{$node["YouTube1"].json["snippet"]["description"].match(/[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/)}}

Hi, thanks! The expression is now valid, but somehow, but it doesn’t return any values, which is weird as matches are found using the same Regex in the node IF.