I'm using this html = html.replace(/([^0-9]).*?\1/ , ''); but it's not quite doing what I'm trying to do. I want to replace the doubles within a string, but still keep at least o
Solution 1:
THink you mean this,
str.replace(/(.)\1+/g, '$1')
or
str.replace(/([^0-9])\1+/g, '$1')
Share
Post a Comment
for "Regex, Removing Recurring Characters But Keeping At Least One"
Post a Comment for "Regex, Removing Recurring Characters But Keeping At Least One"