<?php
$str = ' httpsssss://>.jpeeeeg httpsssss://>.gif';
preg_match_all('~http[s]*://[^\s]+\.(jp[e]*g|png|gif)$~i', $str, $result);
preg_match_all('~http[s]*://[^\s]+\.(jp[e]*g|png|gif$)~i', $str, $result);
PD9waHAKCiRzdHIgPSAnICAgaHR0cHNzc3NzOi8vPi5qcGVlZWVnICAgICBodHRwc3Nzc3M6Ly8+LmdpZic7CgpwcmVnX21hdGNoX2FsbCgnfmh0dHBbc10qOi8vW15cc10rXC4oanBbZV0qZ3xwbmd8Z2lmKSR+aScsICRzdHIsICRyZXN1bHQpOwp2YXJfZHVtcCgkcmVzdWx0KTsKCnByZWdfbWF0Y2hfYWxsKCd+aHR0cFtzXSo6Ly9bXlxzXStcLihqcFtlXSpnfHBuZ3xnaWYkKX5pJywgJHN0ciwgJHJlc3VsdCk7CnZhcl9kdW1wKCRyZXN1bHQpOw==