Well, I think the col -b solution was the best solution, but one
style of regex for your purpose could be:
s/([a-zA-Z])\1/$1/g; #happy now
However this will
clobber lines like this one. Also
we are not considering non-alpha at all.
Update: And
eg has the perl solution that
will work. (Could of sworn that's what I said in the CB)
YAU: I'm assuming the downvote came from
my use of \1 instead of of $1. (Lots of vi editing always
does that to me.) If not, please /msg me and enlighten me.
For those that are wondering about the \1 & $1: Inside
a match use the \1 backreference. Outside use the $1
notation. This doesn't wind up being very important unless
you've got more than nine backreferences. \10 is shorthand
for \010 which is octal. So if you have 10 or more matches
\10 will be the tenth match, otherwise it's octal 10.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.