I have a regex
^[a-z][a-z0-9\-]{6,10}[a-z0-9]$
Which matches the following rules:
- 8-12 characters in length
- first character is lowercase alpha
- last characters lowercase alpha or digit
- internal characters can contain a hyphen
it's re-used a lot in a module, always alongside some other rules and regexes
while writing out some unit tests, i noticed that it's always used in conjunction with another specific rule.
- hyphens may not repeat
i can't wrap my head around integrating that rule into this one. i've tried a few dozen approaches with lookbehinds and lookaheads, but have had no luck on isolating to the specific character AND keeping the length requirement.
and not "--" in somestring