>>373
$a = 'aaajpg|gifaaa';
echo preg_match( '|[a-z]+(?:jpg\|gif)|', $a );