Code to check the condition of video link

I am making an app in which I want to give an option to the user to upload the youtube link which will be further saved in the database.
However, I am unable to understand which condition to put in order to check whether the link is of youtube only. If not then show an alert by saying “Enter the valid youtube link”.
Kindly help me to solve this. :slight_smile:

Hi there,

Maybe you can check if the link contains the word “youtube”.

There is a block for that.

I used the block 'in text “abc” contain “b” ’ but it did not work.

How did you try the block? Could you attach a screenshot?

1 Like


This is the screenshot of the condition I tried to imply.

1 Like

I went to youtube and shared a video link.
I got this
See that it does not contain the text you are looking for and therefore the condition you created will fail.


I tried to put the condition to find only “https://youtu” much of text from the link to but still it did not work.

1 Like

You are trying to test the Input from the user so you can get any type of text which you cannot predict.
A user could type “youtube” without the “https:” part. You made the control entirely to the user.

the how will I verify that whether the user is putting youtube link only ?

In addition to that, the true at the end is unnecessary

1 Like

You need to check the possible combinations not only one. such as,, ......

If I were you I would put the possible combinations in a list and then check every entry in the list against user entry.

1 Like

What is your intention? If you verify that a YouTube link could be valid because it meets all those requirements, it still may not be a link that displays an actual video.

For example, this link is valid (

This one, where I change one character, is not (

One way to check for valid formatting is to use Javascript (or Thunkable). But that doesn’t address the problem I brought up.


You might just want to search for “youtu” and “.com/”