Skip to content

Instantly share code, notes, and snippets.

@girvan
Created August 14, 2013 01:34
Show Gist options
  • Save girvan/6227302 to your computer and use it in GitHub Desktop.
Save girvan/6227302 to your computer and use it in GitHub Desktop.
regex test 0
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(4) {
[0]=>
string(32) "facebook.com/profile.php?id=1234"
[1]=>
string(13) "facebook.com/"
[2]=>
string(15) "profile.php?id="
[3]=>
string(4) "1234"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment