Skip to content

Instantly share code, notes, and snippets.

@girvan
Created August 14, 2013 01:35
Show Gist options
  • Select an option

  • Save girvan/6227305 to your computer and use it in GitHub Desktop.

Select an option

Save girvan/6227305 to your computer and use it in GitHub Desktop.
regex test1
girvan@JARVIS:~$ php -r '$p = "/(?:fb\.me\/|facebook\.com\/)?(?:profile\.php\?id=|groups\/)?(\d+)/";
> $s = "facebook.com/profile.php?id=1234";
> preg_match($p, $s, $m);
> var_dump($m);'
array(2) {
[0]=>
string(32) "facebook.com/profile.php?id=1234"
[1]=>
string(4) "1234"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment