Thread: Regex perts..
View Single Post
Old 02-24-2012, 02:42 PM  
Jakez
Confirmed User
 
Jakez's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
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);
__________________
[email protected] - jakezdumb - 573689400

Killuminati

Last edited by Jakez; 02-24-2012 at 02:46 PM..
Jakez is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote