From: Abder-rahman Ali on
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

I knew that %r is a way to write a regular expression.

But, what is the $, and the i?

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

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

I suppose this shall help
http://www.tutorialspoint.com/ruby/ruby_regular_expressions.htm

--
Thanks and Regards
Saurabh Purnaye
+91-9922071155
skype: sorab_pune
yahoo & gtalk: saurabh.purnaye
msn: psaurabh(a)live.com
--
please don't print this e-mail unless you really need to.


On Mon, Jun 14, 2010 at 8:54 PM, 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
>
> I knew that %r is a way to write a regular expression.
>
> But, what is the $, and the i?
>
> Thanks.
> --
> Posted via http://www.ruby-forum.com/.
>
>

From: Marc Weber on
> But, what is the $, and the i?
-> http://rubular.com/ -> Regex quick reference

The \ escapes the . Thus \. matches the '.' character.

Marc Weber

From: Jesús Gabriel y Galán on
On Mon, Jun 14, 2010 at 5:24 PM, 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
>
> I knew that %r is a way to write a regular expression.
>
> But, what is the $, and the i?

I always have this link handy:

http://www.zenspider.com/Languages/Ruby/QuickRef.html#11

$ matches the end of a line or string
i is a modifier that makes the regexp case insensitive.

Jesus.

From: Brian Candler on
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
--
Posted via http://www.ruby-forum.com/.