Skip to content

Instantly share code, notes, and snippets.

@DenysVuika
Forked from marcgg/gist:733592
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save DenysVuika/86408d83f61426d5b947 to your computer and use it in GitHub Desktop.

Select an option

Save DenysVuika/86408d83f61426d5b947 to your computer and use it in GitHub Desktop.
# Matches patterns such as:
# https://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/#!/my_page_id => my_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
# http://www.facebook.com/my.page.is.great => my.page.is.great
/(?:https?:\/\/)?(?:www\.)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-\.]*)/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment