Regex Check Facebook Video URL -
i try check facebook video url using regex.
this example valid fb video url :
https://www.facebook.com/video.php?v=100000000000000 (valid)
this example valid fb video url username : https://www.facebook.com/{username}/videos/100000000000000
note : {username} can contain string. example : https://www.facebook.com/username1/videos/100000000000000 (valid) https://www.facebook.com/username2/videos/100000000000000 (valid)
but reqex still wrong if check fb video url username.
this regex :
^http(s)?://(www\.)?facebook.([a-z]+)/(?!(?:video\.php\?v=\d+|usernamefb/videos/\d+)).*$
you can run : https://regex101.com/r/df5ip1/6
this work you:
^(https?://www\.facebook\.com/(?:video\.php\?v=\d+|.*?/videos/\d+))$
Comments
Post a Comment