How would I use REGEXREPLACE to group URL paths based on just the first portion of the path (after the domain):
/
/foo/
/foo/bar
/xyz/abc
/xyz
The URL's should group as follows:
/
foo
xyz
My biggest issue with this is how to rename the groups without predefining the group (they should use the matched regex string as the name).
^/([^/]+).*and replace with$1. It would be easier to help seeing some code of yours.