Siri Shortcut Could Not Run Match Text

I’m trying to build a Siri Shortcut that takes a Youtube URL and extracts the name of the video. I’ve gotten this regex to work on, but it doesn’t seem to work in my shortcut. It gives me an error that says “Could Not Run Match Text” and says the regex is invalid, but doesn’t give any more detail than that.

Any ideas? Thanks in advance!

Can you capture Shortcuts sample input from however you are passing into YouTube (The Copy to clipboard action can be useful), then highlight or pull out what you want to match.

Starting with a single example of known data and expected result can help.

Sometimes RegEx issues like this can be down to RegEx101not supporting the ICU flavour of RegEx that Shortcuts uses and there being differences between them. Sometimes it can be down to what you have viewed as source on a page isn’t necessarily what is passed to another app (e.g. maybe you are expecting the HTML of the page but get the rich text of the page, or maybe the JSON is reordered).

Have you copy pasted the regex or typed it by hand from regex101? I suspect the latter because you didn’t escape the { which is most definitely the error. I’m pretty sure that regex101 also marks this as an error since the curly braces are used as quantifiers.

One tip I have for you is that you should make (.+) lazy i.e. (.+?). The reason is that if there are other keys following the title key then your regex picks them up as the value of title.

Sorry for the delay, was on vacation. Of course you’re right, I forgot to escape the {. And the lazy thing helped a lot too. Thanks!

Sorry for the delay, was on vacation. Thanks for the help!