if(string =~ /.*[\a\b\e\f\n\r\t\v].*/) puts "Invalid string" else puts string + " is ok" end On 5/15/07, Mike Steiner <mikejaysteiner / gmail.com> wrote: > Is there an easy way to test if a string is printable (doesn't contain > control characters)? Something easier than listing out all the letters, > numbers, and punctuation and checking each character. > > Mike Steiner >