How to detect facebook link

Hey guys, I want to detect link which will be entered by user is a facebook link or a instgram link and also link which has been entered is a valid facebook or ig link. How can i do this. please help. Thank You

Check if the Text Box contains URL