[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:02040] Re: Ruby Syntax similar to other languages?

From: matz@... (Yukihiro Matsumoto)
Date: 2000-03-21 01:38:35 UTC
List: ruby-talk #2040
Hi,

In message "[ruby-talk:02027] Re: Ruby Syntax similar to other languages?"
    on 00/03/20, David Suarez de Lis <excalibor@demasiado.com> writes:

|Good morning, (for me :)

Good morning, (for me :)

|> Hmm, although I think options i, s, m, o, and x should belong to
|> regexp, I can understand your opinion.
|
|Certainly, options should belong to the re... that would make it
|
|string.s(/regex/imx, "replacement" [, OVERWRITE])

Well, regexp options i, o, x are available now.  There's no equivalent
for Perl's s, m, but p - posix match - for treating newlines as a
normal character.

|Even ``string =~ /regex/i'' looks unnatural... (even very familiar to sed, vi, Perl users)
|
|I'd  rather reduce interfaces  to ``string.m(/regex/i)''  which feels
|more like  OO to  me: apply the  m(atch) method to  object ``string''
|with this regex object ``/regex/'' with options ``i''

There's already Regexp#match.  e.g.

  /regexp/.match(str)

							matz.

In This Thread

Prev Next