[#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:02264] Re: Multiple assignment of pattern match results.

From: matz@... (Yukihiro Matsumoto)
Date: 2000-03-30 13:36:22 UTC
List: ruby-talk #2264
Hi,

In message "[ruby-talk:02256] Multiple assignment of pattern match results."
    on 00/03/30, schneik@us.ibm.com <schneik@us.ibm.com> writes:

|The only problem I have with this example is that scan is going through the
|work of producing an array of arrays, even though I only want the first
|match:

a)

  x="aabbbccccdddeeeefffabcdeabcdeabcde"
  (dummy, t, u, v) = /(a+)[^ace]*(c+)[^e]*(e+)/.match(x).to_a

b)

  t = u = v = nil
  x.scan(/(a+)[^ace]*(c+)[^e]*(e+)/) do |t,u,v|
    break
  end


In message "[ruby-talk:02257] Re: Multiple assignment of pattern match results."
    on 00/03/30, mrilu <mrilu@ale.cx> writes:

|I think it's time for String.scan(pattern[, limit]), like split.

Interesting.

							matz.

In This Thread