in reply to Re: Replace consecutive whitespaces with single whitespace
in thread Replace consecutive whitespaces with single whitespace
Note also that using \s matches more than the space the OP mentioned. In particular, s/\s+/ /g or s/\s{2,}/ /g will replace one (two) or more newlines with a space.$str =~ s/\s{2,}/ /g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Replace consecutive whitespaces with single whitespace
by tilly (Archbishop) on Mar 26, 2009 at 21:38 UTC | |
by JavaFan (Canon) on Mar 27, 2009 at 08:10 UTC | |
by tilly (Archbishop) on Mar 27, 2009 at 13:20 UTC |