I have this regex pattern ^(\/([a-z]+)?-?([a-z]+)?)+$ I am testing it in https://regex101.com/r/Se3e70/1/. The pattern it accepts are
- /abc
- /abc-def
- /
- /abc/abc
- /abc/abc-def
but the problem is it also accepts
- /-
- /abc-
which I do not want.
How can I make sure to avoid these?