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+))$ 

demo

https://regex101.com/r/sc6or2/3


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -