> Let me give it a shot...How about this? > --Rex > > $string = "I want to delete all this spaces, but this"; > $string =~ s/\s{1}(?=\w)//g; print $string;
1) I bleive you meant \S and not \w $string =~ s/\s{1}(?=\S)//g; print $string; 2) It doesn't work correctly. You will delete the last one of the spaces in each group. What about $string =~ s/( *)/((length($1) > 1) ? $1 : '')/ge; print $string,"\n"; Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]