Something like : ^(.+)\:(.+?)(\/|$)(.*?)(\/|$) (repeating (.*?)(\/|$) to the number of possible results will get you in even numbered fields the results you want. So for 1-4:^(.+)\:(.+?)(\/|$)(.*?)(\/|$)(.*?)(\/|$)(.*?)(\/|$)You can see the results here: https://regexr.com/3sjh5