Just for fun and a slap stick regex ...
<?php
$string = 'http://photos-e.ak.fbcdn.net/hphotos-ak-snc1/hs132.snc1/5653_504358248751_308030211_139556_1421132_s.jpg';
$start_regex = microtime(true);
for($i = 0; $i < 5000; $i++)
preg_match('#.*_([^_]+)_.*_.*_.*#', $string);
echo 'Regex took ' . (microtime(true) - $start_regex) . ' seconds.' . "\n";
$start_explode = microtime(true);
for($i = 0; $i < 5000; $i++)
explode('_', $string);
echo 'Explode took ' . (microtime(true) - $start_explode) . ' seconds.' . "\n";
$start_split = microtime(true);
for($i = 0; $i < 5000; $i++)
split('_', $string);
echo 'Split took ' . (microtime(true) - $start_split) . ' seconds.' . "\n";
root@server [/home/lamppdev/phptests]# php -f split_explode_test.php
Regex took 0.0194711685181 seconds.
Explode took 0.0091540813446 seconds.
Split took 0.0346639156342 seconds.
root@server [/home/lamppdev/phptests]# php -f split_explode_test.php
Regex took 0.0202159881592 seconds.
Explode took 0.00892806053162 seconds.
Split took 0.0341391563416 seconds.
root@server [/home/lamppdev/phptests]# php -f split_explode_test.php
Regex took 0.0192739963531 seconds.
Explode took 0.0103480815887 seconds.
Split took 0.0351750850677 seconds.
root@server [/home/lamppdev/phptests]# php -f split_explode_test.php
Regex took 0.0201539993286 seconds.
Explode took 0.00944900512695 seconds.
Split took 0.0367538928986 seconds.
root@server [/home/lamppdev/phptests]#
I have always found explode to be fastest for these simple tasks.