From: Abder-rahman Ali on
Brian Candler wrote:
> Abder-rahman Ali wrote:
>> %r{\.(gif|jpg|png)$}i
>>
>> I knew that %r is a way to write a regular expression.
>>
>> But, what is the $, and the i?
>
>
> http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html#UK

Thanks Brian.

--
Posted via http://www.ruby-forum.com/.

From: Josh Cheek on
[Note: parts of this message were removed to make it a legal post.]

On Mon, Jun 14, 2010 at 10:24 AM, Abder-rahman Ali <
abder.rahman.ali(a)gmail.com> wrote:

> I'm new to Ruby, and just want to ask about how to read the following
> statement from the "Agile Web Development With Rails, 3rd edition" book:
>
> %r{\.(gif|jpg|png)$}i
>
>

It matches a dot, followed by either gif or jpg or png, at the end of the
string. It does not care about case.

For example, it would match

foo.gif
foo.GiF
fOoO.jpg
bar.PNG


It would not match

foogif
foo.gif.
foo.giff
foo.jp
foo.pjg
foo.jpx
foo.jpg.csv

From: Rein Henrichs on
After referring to the regular expressions references provided, test
them out at rubular.com.

--
Rein Henrichs
http://puppetlabs.com
http://reinh.com