186
rated 0 times
[
190]
[
4]
/ answers: 1 / hits: 40944
/ 11 Years ago, thu, october 10, 2013, 12:00:00
I have found a way to remove repeated characters from a string using regular expressions.
function RemoveDuplicates() {
var str = aaabbbccc;
var filtered = str.replace(/[^ws]|(.)1/gi, );
alert(filtered);
}
Output: abc
this is working fine.
But if str = aaabbbccccabbbbcccccc
then output is abcabc
.
Is there any way to get only unique characters or remove all duplicates one?
Please let me know if there is any way.
More From » regex