Reputation: 1329
I am trying to extract Facebook URL's from 3 sites using PHP and a regular expression but it's not working for me. I can use regex101 https://regex101.com/r/zA2sD8/1 to match but i can't get this out in PHP using preg_match. Here is my regex so far:
https://regex101.com/r/zA2sD8/1
Upvotes: 1
Views: 69
Reputation: 80649
Try the following pattern:
((?:https?://)?(?:www\.)?facebook\.com\S*)
of course, you'll have to use a different delimiter than /
(like @
or #
etc.).
You'll also need to use preg_match_all
instead of preg_match
to imitate the global matching (g
flag).
Upvotes: 1