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.
\. => contains a dot (gif|jpg|jpeg|png) => then, either one of these extensions $ => the end, nothing after it i => case insensitive
\.
(gif|jpg|jpeg|png)
$
i
And it's the same as writing /\.(gif|jpg|jpeg|png)$/i.
/\.(gif|jpg|jpeg|png)$/i