Alıntı
$str = 'href="http://www.facebook.com/profile.php?id=100001222122522"';

preg_match_all('~profile\.php\?id=(\d+)~Usi', $str, $match);
print_r($str);
Denemedim çalışması lazım