Skip to content

Instantly share code, notes, and snippets.

@damusnet
damusnet / gist:3323622
Created August 11, 2012 10:28 — forked from marcgg/gist:733592
Regex to get the Facebook Page ID from a given URL
<?php
$tests = array(
'http://www.facebook.com/page_id' => 'page_id',
'https://www.facebook.com/page_id' => 'page_id',
'http://www.facebook.com/#!/page_id' => 'page_id',
'http://www.facebook.com/pages/Parisé-France/Vanity-Url/123456?v=app_555' => '123456',
'http://www.facebook.com/pages/Vanity-Url/45678' => '45678',
'http://www.facebook.com/#!/page_with_1_number' => 'page_with_1_number',
'http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678' => '45678',
'http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334' => 'my_page_id',