Regular expression to remove duplicate letters

I have a document in Notepad ++ where each line can contain any combination of characters. For instance:

RRGG U XB UUGG UG 

What I would like is a regular expression to remove any duplicate characters. So, given the above, I would be left:

 RG U XB UG UG 

I tried to find ([az]) and replace \1 with what I saw on the Internet, but received nothing. I even tried to find ([az])+ , but it just got me the last letter on the line (not sure why I thought this would work, except for me terribly in regex). I also do not want to get rid of any spaces or blank lines. What is the best way to do this?

+6
source share
1 answer

Search:

 ([AZ])\1+ 

Replaced by:

 \1 
+15
source

Source: https://habr.com/ru/post/950369/


All Articles