Question: How to check if the string contains a valid vimeo url using javascript ?

Example : <https://vimeo.com/23374724> is a valid url.

Answer: 
I don't know what "a valid vimeo url" is, precisely. If you want it to begin with `https://vimeo.com/` and be followed by an 8 digit number, this will do that:

```
var myurl = "https://vimeo.com/23374724";
if (/https:\/\/vimeo.com\/\d{8}(?=\b|\/)/.test(myurl)) { 
    alert("matches"); 
} else { 
    alert("doesn't match") 
};

```

It's kind of ugly, because of all the `\/` escaped forward slashes, but what it does is look for the string I mentioned above, followed by a sequence of 8 digits that is followed by any zero-width word boundary or another forward slash.
You can use the following regex:

```
(?:https?\:\/\/)?(?:www\.)?(?:vimeo\.com\/)([0-9]+)

```

The id of the video will be captured in group 1, if you need to use that. You can see it in action on [debuggex](http://www.debuggex.com/?re=%28?%3ahttps?%5C%3a%5C/%5C/%29?%28?%3awww%5C.%29?%28?%3avimeo%5C.com%5C/%29%28%5B0-9%5D%2b%29&flags=&str=https://vimeo.com/23374724%20and%20https://vimeo.com/23374726).