Bill Kelly wrote:
> From: "Mike Steiner" <mikejaysteiner / gmail.com>
>>
>> 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.
> 
> Based on: 
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/248540
> 
> To test for non-printable characters, use:
> 
>  str =~ /[^[:print:]]/
> 
> 
Even though I am not the OP I tried that and using index but none of 
them seem to work.  I get an error message saying "warning character 
class has '[' without escape" followed by "warning regexp has ']' 
without escape" and the return is nil regardless what is in the string.
Is there something I am missing here?


> 
> Regards,
> 
> Bill
> 
> 
>