- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$s = '/var/www/vb/frontend/web/img/up/bf9b12de5ea78cecacd3dde69f2a72f8/676/6dc6c807e1cef2ba8af8e422abe77286/5/l.jpg';
var_dump(
preg_match_all('/(.*)\/img\/up\/(.*)\.jpg/', $s, $matches),
$matches
);