I'm adding a validation check on a rails model using the following regex:
validates :reference, :presence => true, :format => { :with => /^[a-zA-Z0-9_. ]*$/i }
This check will match any non alphanumeric chars and ignores underscore and dot.
When testing on rubular.com, the regex fails to match any of the above mentioned patterns. Instead, rubular matches using this regexp:
/[^a-zA-Z0-9_. ]/i
Anyone knows what the reason behind the difference between the two?
Thanks