On Nov 28, Michael Fowler said: >On Wed, Nov 28, 2001 at 11:56:30AM -0800, Ahmed Moustafa Ibrahim Ahmed wrote: >> You don't you need the line beginning and line termination in >> s/(^|[^ ]) ([^ ]|$)/$1$2/g; > >Given a version of Perl 5.6 or greater, then the substitution could become: > > s/(?<! ) (?! )//g;
That works in 5.005 too. But I reiterate this approach ends up being horrible on chunks of whitespace. You might hope Perl is smart enough to do something like: "abc def ghi jkl mno" ^ | failed here, so jump to next chunk of whitespace Too bad, Perl doesn't optimize this regex that way. It tries matching at EACH space in that " " chunk, which is poor form. :( -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]