In a model there is a field
validates :image_file_name, :format => { :with => %r{\.(gif|jpg|jpeg|png)$}i
It looks pretty odd for me. I am aware that this is a regular expression. But I would like:
- to know what exactly it means. Is
%r{value}
equal to/value/
? - be able to replace it with normal Ruby regex operator
/some regex/
or=~
. Is this possible?