Mega Code Archive

 
Categories / Ruby / String
 

Use whitespace as the place holder

" \bIt's whitespace, Jim,\vbut not as we know it.\n".gsub(/[\s\b\v]+/, " ") # => " It's whitespace, Jim, but not as we know it. "