moola Posted March 29, 2007 Share Posted March 29, 2007 http://s64.photobucket.com/albums/h162/Chuckie82892/?action=view¤t=Shannon411.flv How do you match h162 (letter number number number) *variable and Chuckie82892 (username) *variable and Shannon411.flv (videoname) *variable Thanks Quote Link to comment Share on other sites More sharing options...
c4onastick Posted March 30, 2007 Share Posted March 30, 2007 You match 'h162' with: %[a-z]\d{3}% Or more generally: %[a-z]\d+% (% is my delimiter) 'Chuckie82892' is tougher, you have to assume that it is always between '/' and '/?' to match it. You could use this: %[a-zA-Z]{2,}\d+% But that will also match 'Shannon411.flv'. (Works in this case since Chuckie comes first) Matching 'Shannon411.flv' is easy, just assuming that whatever comes after 'current=' is what you want: %current=(.*)% To get these all individually would be a pain and pointless really since you can do it all in one foul swoop: preg_match('%albums/([^/]+)/([^/]+)/\?.*?current=(.*)%', $url, $matches); $matches contains: Array( 'albums/h162/Chuckie82892/?action=view¤t=Shannon411.flv', 'h162', 'Chuckie82892', 'Shannon411.flv' ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.