I've got a simple string with some of the duplicating characters there. Can someone please help me fix the expression below to remove NOT only duplicated characters but ALL characters that have more than 1 occurance.
console.log('aaabbxxstring'.replace(/(.)(?=.*?\1)/g,'')); // string
I am capturing a matching character using lookahead and replace the match with a whitespace. The question is how to replace the capturing group itself. Or is the entire approakch incorrect?