I am testing two strings and want a common regex to be applied based on the condition if one group exists then apply the Regex Pattern, else other Pattern, but some reason on Regex online editor it seems that the ?=() is not recognized to add if else condition.
I have the following 2 test strings:
/public/weltweit/nfsk/2022/05/18/668e9f57-30be-40b6-bc85-5bf66671e41d/668e9f57-30be-40b6-bc85-5bf66671e41d_AVC-270.mp4
Expected extraction using ^\/(\bpublic\b[\/])*(.+[a-z]{1,}.*[\/|_]+)+.*?$ is
weltweit/nfsk/2022/05/18/668e9f57-30be-40b6-bc85-5bf66671e41d/668e9f57-30be-40b6-bc85-5bf66671e41d_
which is expected but for the other test string :
/medp/ondemand/weltweit/fsk0/258/2580407/2580407_40256616.mp4 with same Regex I get medp/ondemand/weltweit/fsk0/258/2580407/2580407_
My expected extraction is **medp/ondemand/weltweit/fsk0/258/2580407/**
I want to add a if condition to a group (\bpublic\b[\/]) so that an underscore **_**is chosen if the group exists; otherwise a slash **/**
Any pointers is appreciated.
Thank you!