[EMAIL PROTECTED] (Jeff 'Japhy' Pinyan) writes:
> On Nov 28, Leon said:
> >(Q2)    How to do the following :-
> >           If there are 2 spaces, I wish to convert it into 1 &nbsp like
> >this =>&nbsp
> >           3 spaces into 2 &nbsp like this => &nbsp&nbsp
> >           4 spaces into 3 &nbsp like this => &nbsp&nbsp&nbsp
> 
> I would do something like this:
> 
>   s/ ( +)/' ' x length($1)/g;
> 
> That matches a space and then one or more spaces and stores the "one or
> more" part in $1.  The length of $1 is 1 less than the number of spaces
> found.

You need a /e option to make that work...

--Bill.

-- 
William R Ward            [EMAIL PROTECTED]          http://www.wards.net/~bill/
-----------------------------------------------------------------------------
     If you're not part of the solution, you're part of the precipitate.

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

Reply via email to