I need to create a validation that determines whether a string will be made only of duplicate characters. So, for example, he would catch "pp", but not "satisfied."
So far, I can check the repetition of char with this:
/(.)\1+/.test(value);
How can I change this regex to catch “pp” and not catch “happy”? Would regex be the best way to do this?
source
share