Hi All,
Having some difficulties figuring out how to create regex that adjusts to the number of groups.
I can have any number of parts ranging from 1 to 4
strings:
events:company-conferences/company-user-conference/2018
events:company-conferences/company-user-conference
events:company-conferences
I tried this regex however it only returns the correct values if it has 4 capture groups, no more no less.
^([^\:]*)\:([^\:]*)\/([^\:]*)\/([^\:]*)

I tried the below regex however it does the same
^(.+)\:(.+)\/(.+)\/(.+)
is there regex logic that is flexible to the number of capture groups in a string? I would like to capture string that have groups up to 4 but may have 3 or 2.
any help would be highly appreciated.
thanks