But it does. the \B only matches a non-word boundary, so the match can't include the first and last letter. Secondly, if the word is too short, it just fails to match at all. -Kurt On Wed, Sep 17, 2003 at 07:35:11AM +0900, Gavin Sinclair wrote: > On Wednesday, September 17, 2003, 4:33:23 AM, Kurt wrote: > > > Try > > > -pe 'gsub!(/\B\w+\B/){$&.split(//).sort_by{rand}.join} > > > Shorter (and even cleaner too!) > > > -Kurt > > That looks to me like it will not preserve the first and last letter > in each word, which is a requirement. > > Gavin > > >======= End of Original Message =======<