Skip to content

Instantly share code, notes, and snippets.

@peterwang
Created July 17, 2013 14:12
Show Gist options
  • Save peterwang/6020889 to your computer and use it in GitHub Desktop.
Save peterwang/6020889 to your computer and use it in GitHub Desktop.
<?php
$input = isset($argv[1]) ? $argv[1] : 'fb.com/username';
$pattern = '#(?:https?\://)?(?:www\.)?(?:facebook|fb)\.com/(\d+|[A-Za-z0-9\.]+)/?#';
var_dump(preg_match($pattern, $input, $matches));
var_dump($matches);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment