$string = '
https://clips.twitch.tv/SneakyFantasticMoonLitty123
или так
https://www.twitch.tv/lex4tor88/clip/SneakyFantasticMoonLitty456?filter=clips&range=all&sort=time
';
if(preg_match_all('/twitch\.tv\/(?:[^\/]+\/clip\/)?([0-9a-z]+)/uis', $string, $matches)) {
print_r($matches[1]);
}
<?php
$url = 'https://www.twitch.tv/lex4tor88/clip/SneakyFantasticMoonLitty?filter=clips&range=all&sort=time';
var_dump(
basename(parse_url($url, PHP_URL_PATH))
);