in reply to Re: removing duplicate letters
in thread removing duplicate letters

Actually, the dot operator doesn't fit his definition. eduardo specified letters so we should change it to
s/(\w)(\1)/$1/g;
Update: Oops! takshaka exposed me for the fake I am! (see reply below)

Replies are listed 'Best First'.
RE: RE: Re: removing duplicate letters
by takshaka (Friar) on Jun 19, 2000 at 01:53 UTC
    If we're going to be pedantic, \w matches nonletters as well. Use a character class with the appropriate definition of "letters".

    s/([a-zA-Z])\1/$1/g;

      if you want to talk about pedantic, your letters may not be the letters everyone else is using, so to take the locale into effect, you could do something like the following:

      s/([^\W\d_])\1/$1/g