in reply to removing duplicate letters
Whoops, missed the + the first time! Let's say the first was a warm up, and the second actually works:$newword = join '', split(/(\w+)\1/, $word);
There. Appropriately hard to read.$newword = join '', split(/((\w)+)\1(\2{0,1})/, $word);
Update: Yes, I had the backreferences backward, which breaks things, as the Anonymous Monk points out below. That'll teach me to be crafty.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: removing duplicate letters
by Anonymous Monk on Jun 19, 2000 at 02:30 UTC |