// bunun için regex kullanmaya gerek yok
$url = "https://www.youtube.com/channel/UCgExa-5JOkNAwSUuGSjRhtA/";
echo rtrim($url, '/');