I'm looking for a simple regular expression to match the string where no repeated characters. Example:
You may do negation through negative lookahead.
^(?!.*(\w)\1{3,}).+$
DEMO
If its a duplicate 3 or more times in a row, this is the fastest
way to do it. (no phony demo provided)
^(?:(.)(?!\1{2}))+$
^
(?:
( . ) # (1)
(?! \1{2} )
)+
$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With