How to get the numbers at the end of the line?

Hello!
There is a line of the form:
485-word-cost-22.jpg
Need to figure 22, how to use preg_replace to do this?
July 8th 19 at 16:24
2 answers
July 8th 19 at 16:26
-(/d+).jpg ?
July 8th 19 at 16:28
$s = "485-word-cost-22.jpg";
$r = preg_replace('/^.*\-(\d+)\.jpg$/', '$1', $s);
echo($r);

Find more questions by tags PHP