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;

It depends on what is desired in the two edge cases of " foobar" and
"foobar ", and what version of Perl is being used.  I was assuming they
should both become "foobar", thus the line beginning and ending assertions.
I was also assuming a version of Perl prior to 5.6.

Given a version of Perl 5.6 or greater, then the substitution could become:

    s/(?<! ) (?! )//g;

 
> Would
> s/([^ ]) ([^ ])/$1$2/g
> be simpler?

If the edge cases mentioned above should remain unchanged, then yes.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to