I want to replace all the words XXX/XXX/XXX/... with one XXX/
For example:
www.domain.com/XXX/XXX/XXX/XXX/XXX/section/XXX/XXX
should be:
www.domain.com/XXX/section/XXX
How can i do it with regex instead of:
str.replace("XXX/XXX","XXX").replace("XXX/XXX","XXX").replace("XXX/XXX","XXX").replace("XXX/XXX","XXX").replace("XXX/XXX","XXX").replace("XXX/XXX","XXX");
Thanks