Over a million developers have joined DZone.

File Extension Regex

·

# returns nil if not found or numerical index if found
"dog.jpg" =~ /.*(jpg|png|gif)$/

validates_format_of :image_url, :with => %r{\.(gif|jpg|png)$}i


Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}