Given an array of strings, test if there's any character appeared exactly two times.
Sample:
const input = ['asdf', 'fdas', 'asds', 'd fm', 'dfaa', 'aaaa', 'aabb', 'aaabb'];
const output = ['asds', 'dfaa', 'aabb', 'aaabb'];
I tried like this
/(?:^|(.)(?!\1))([A-Za-z0-9])\2(?!\2)/
but I got only these strings: ['dfaa', 'aabb', 'aaabb']
.
Please any suggestions?