spa3212 1 Posted August 23, 2017 Report Share Posted August 23, 2017 (edited) Hi,Thanks for being so supportive and here I am again stuck in scraping a profile url of facebook, as you know facebook profile sometime comes with name and some time with ID.. like https://www.facebook.com/cindyjuana.chavezsometime https://www.facebook.com/profile.php?id=100010928299153 How I scrape these two kinds of url Many many thanks for your help If found a regex but don't know who to use ^(?:.*)\/(?:pages\/[[:alnum:]-]+\/)?(?:profile\.php\?id=)?([[:alnum:].]+) Edited August 23, 2017 by spa3212 Quote Link to post Share on other sites
spa3212 1 Posted August 24, 2017 Author Report Share Posted August 24, 2017 anyone can help? Quote Link to post Share on other sites
HelloInsomnia 1103 Posted August 24, 2017 Report Share Posted August 24, 2017 Are the names always in that format where it has a dot in them? If you can provide more examples then I can make a more exact regex possibly but for those urls you can use this: https\:\/\/www\.facebook\.com\/(profile\.php\?id\=\d+|[a-z]+\.[a-z]+) It's just likely that it will pick up on other things as well. And it looks for the dot in the profile as well to avoid pages like /about Quote Link to post Share on other sites
spa3212 1 Posted August 24, 2017 Author Report Share Posted August 24, 2017 But I want to use this regex to add list to list when do this nothing happens..I am doing something wrong for sure. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted August 24, 2017 Report Share Posted August 24, 2017 But I want to use this regex to add list to list when do this nothing happens..I am doing something wrong for sure. Would need to see the code you are seeing in order to see whats going on. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.