I want to check if a string has the same start and end character and all characters in between are different from the start and end character.
Examples:
"abcda"should pass, because it starts and ends witha, and has only non-as in the middle,"abada"should fail, because it not only hasaat the start and end, but also in the middle,"bcdefb"should pass — see the first example.
I tried to do it by (.)(?!.*\1)\1, but it failed because there is no length limit, negated end of the string either.