Hi mukesh1,
Vimeo have below different types video links.
Video - vimeo.com/VideoId
Channels - vimeo.com/channels/Channel/VideoId
Groups - vimeo.com/groups/Group/VideoId
Player - player.vimeo.com/video/VideoId
Use below RegularExpression for validate the url.
(?:http|https)?:?\/?\/?(?:www\.)?(?:player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)
Refer below example.
HTML
<asp:TextBox ID="txtUrl" runat="server" />
<asp:Button Text="Validate" runat="server" OnClick="OnValidate" />
Code
C#
protected void OnValidate(object sender, EventArgs e)
{
System.Text.RegularExpressions.Regex regx =
new System.Text.RegularExpressions.Regex(@"(?:http|https)?:?\/?\/?(?:www\.)?(?:player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)");
System.Text.RegularExpressions.Match match = regx.Match(txtUrl.Text.Trim());
if (match.Success)
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + txtUrl.Text.Trim() + " is valid');", true);
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + txtUrl.Text.Trim() + " is invalid');", true);
}
}
VB.Net
Protected Sub OnValidate(ByVal sender As Object, ByVal e As EventArgs)
Dim regx As System.Text.RegularExpressions.Regex =
New System.Text.RegularExpressions.Regex("(?:http|https)?:?\/?\/?(?:www\.)?(?:player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)")
Dim match As System.Text.RegularExpressions.Match = regx.Match(txtUrl.Text.Trim())
If match.Success Then
ClientScript.RegisterStartupScript(Me.GetType(), "alert", "alert('" & txtUrl.Text.Trim() & " is valid');", True)
Else
ClientScript.RegisterStartupScript(Me.GetType(), "alert", "alert('" & txtUrl.Text.Trim() & " is invalid');", True)
End If
End Sub
Screenshot