I have tried to pattern match this kind of url with several attempts but I seem to be missing something. Please help me to figure this out because I have over a thousand urls that need this kind of change.

http:///www.domain.com/foo2.3/v/album_name/subalbum_name/pages.php?pageid=17 [This is the example URL and the subalbum_name will change]