HELP ME PLS…
Im trying to remove adjacent duplicates in a string, the current code I have is not working -
string.gsub(“baaab”, “(%a)%1+”, “%1”)
I’m trying to get this to return “bab” not “baaab” or remove any adjacent duplicates in a sting, If I use -
string.gsub(“baaab”, “(%a)%1%1”, “%1”)
I’ll get “baab”
For some reason I cannot get the “+” to work when referencing a capture am I doing something wrong or is this not possible.
Also the regex that worked on an online regex calculator was (\w)\1+ if it helps.
Thanks!