0👍
My guess is that you’re trying to write some expression, that’d look like:
(/required/)(?:identifier/optional1/optional2/)(.*)
and replace it with $1$2
.
If you wish to explore/simplify/modify the expression, it’s been
explained on the top right panel of
regex101.com. If you’d like, you
can also watch in this
link, how it would match
against some sample inputs.
Source:stackexchange.com