I am trying to get the facebook username or id from a facebook url and was wondering if you could help me. I’m sure it’s just a simple regex function but I have tried and can’t seem to do it myself.
Here’s what I’ve been trying to get from the url.
http://www.facebook.com/myusername/
or the numerical id
http://www.facebook.com/2285652/
I would be very grateful if anyone could help me achieve this via PHP
The pattern is versatile so it matches:
wwwprefix./.