Should have mentioned there might be a long list of them and not just 2.
This is the best I could do and it works but it's messy and returns too much other shit
preg_match_all("/([A-Za-z0-9]{4}(jpg|jpeg|gif|png))/","ASDFjpgBLAHjpgQWERjpg",$matches);
Edit: ok this is better but still returning a bunch of "jpg" on the end.
preg_match_all("/[A-Za-z0-9]{4}(jpg|jpeg|gif|png)/","ASDFjpgBLAHjpgQWERjpg",$matches);
|