Ahmed,

As it was an oversight and Jenda had rightly pointed out, my solution eats
up one space if there is more than one concatenated space!

$string =~ s/\s{1}(?=\S)//g;

By the aforementioned statement, I meant -- Match a space that is
immediately followed by a non-space character. If a find is successful,
replace such occurences with nothing and repeat it globally. 

I guess your solution could be simplified as this, right?

$string =~ s/(\S)\s(\S)/$1$2/g;

-- Rex


> -----Original Message-----
> From: Ahmed Moustafa Ibrahim Ahmed [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 28, 2001 1:39 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: deleting white spaces
> 
> 
> Rex,
> 
> Would you explain your regexp, please? Also, what do you 
> think about this:
> $string =~ s/([^\s])\s([^\s])/$1$2/g;
> 
> Thanks,
> 
> 

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

Reply via email to