Regex to validate string having only characters (not special characters), blank spaces and numbers

Viewed 16389

I am using Ruby on Rails 3.0.9 and I would like to validate a string that can have only characters (not special characters - case insensitive), blank spaces and numbers.

In my validation code I have:

validates :name,
  :presence   => true,
  :format     => { :with => regex } # Here I should set the 'regex'

How I should state the regex?

3 Answers
Related