From: Paul Lutus Date: 2006-09-13T03:05:50+09:00 Subject: Re: removing spaces between single characters with regual expression ciapecki wrote: > I want to remove the spaces in the string only then when they stand > between 2 single characters. > for example: O J Simpson should be translated into OJ Simpson > 'A B C' -> 'ABC' This conversion doesn't follow from your expressed rule. It is, not two, but three, single characters separated by spaces. > 'AB C' -> 'AB C' (no change) This is why your example of 'A B C' -> 'ABC' doesn't actually follow from your request. The first step is to convert 'A B C' -> 'AB C', then the next conversion won't happen because the string is no longer two single characters separated by a space. > 'Teddy Bear A B' -> 'Teddy Bear AB' > > how can I do that with regular expression? --------------------------------------- #!/usr/bin/ruby data=<