Given the following strings:
'/a/xxx/b/c/xxx/xxx/d/e/xxx/xxx/f/g'
'/a/xxx/b/c/xxx/xxx/d/e/xxx/xxx/f/'
'/a/xxx/b/c/xxx/xxx/d/e/xxx/xxx/f'
'/a/xxx/b/c/xxx/xxx/d/e/xxx/xxx/f/g/xxx/xxx'
I'm looking for a regex that will match
/a/xxx/b/c/xxx/xxx/d/e/xxx/xxx/f
for all of the above strings
That is, match everything until the last occurrence of this pattern:
{forward slash or start of string} then {xxx} then {forward slash} then {any group of chars (except forward slash) that is not equal to xxx } then {forward slash or end of string}
I do not know how to translate the above pattern into a regex.
The .*\/
pattern I tried does not solve the problem.