How to use the regular season to split the string?

There is a line https://vk.com/photo212455842_372111103,
need to break the array to get this part 212455842 and this 372111103
tried to do so
preg_split('/\d([0-9]*)/g'), 'https://vk.com/photo212455842_372111103');

Not going to fly!
June 27th 19 at 15:01
2 answers
June 27th 19 at 15:03
preg_match('/photo(\d+)_(\d+)/', 'https://vk.com/photo212455842_372111103', $res);
var_dump($res);
June 27th 19 at 15:05
Consider another possible minus sign before the first number, when photos uploaded to the community. For example, it may be https://vk.com/photo-212455842_372111103

<?php
$url = "https://vk.com/photo212455842_372111103";
if( preg_match("/(\-?\d+)_(\d+)$/", $url, $result)) {
 $owner_id = $result[1]; // 212455842
 $photo_id = $result[2]; // 372111103
 echo "$owner_id - $photo_id\n";
} else {
 echo "do Not match th-t..\n";
}</property-->

Find more questions by tags PHPRegular expressions