Is there a way to write a regex to match a string that only contains certain characters, and never repeats those characters? I already wrote some code using a set to impleme
I'm answering this question
Visual C++ Regex: Matching no repeating letter
which was marked an exact duplicate of this question.
No repeating of any letter ?
Does that mean consecutive letters, or is abaca
ok ?
if not, the regex would be yours modified to this :
^(?=.*[a-z])(?!.*([a-z]).*\1).{4,20}$
Expanded
^
(?= .* [a-z] )
(?!
.*
( [a-z] ) # (1)
.* \1
)
.{4,20}
$