Validate all Facebook URL schemes

Amir Diafi
May 31, 2021

In order to put the user Facebook URL in your App, you need to validate the value of the input if it is correct or not.

Facebook comes with many URL schemes for example:
fb.com
facebook.com
m.fb.com

and you need to handle the user inputs value and see if the user has put HTTP or HTTPS or with www or without.

to handle all of that you need this function.

learn more about regular expression in Javascript:
https://javascript.info/regexp-alternation

--

--