Hi Raul,

> > re_prefix = %r/\G (\d+  [.]?) /x

I have learned something: I saw immediately that the mistyped version
was not what you intended because the dots would have been captured.
I applied your correction and things worked as advertised.

> ... you have found a way to implement with Regexps your
> original design (you did not fool me! :-);

:BG

> great ingenuity [snip] stunned by your progress

Thanks for the compliments,  but they're not merited in this respect:

I wrote my first program circa 1955 (on paper only; no execution)
after receiving a letter from a former high-school classmate
announcing that he had encountered new-fangled machines at Princeton
called "computers".  He furthermore recounted their instruction set.
I was hooked.  After grinding out a degree from night-college and
earning an NSF graduate fellowship in math, I finally got a job
programming a real computer,  which I continued until I retired a few
years ago.

> I must be frank.

Absolutely.  I've invited that, and am also impressed with your
gracious approach.

> I do not like building arrays to meet some 'maximum treshold', leaving
portions of them empty; it just does not make me 'happy' (in the
Matz/Ruby sense, do you understand?). Of course, it is just an array
of
5 positions, but it does not matter; it is just echologically wrong
for
me.

I acknowledge and share the aesthetic validity of your displeasure.

> I however understand your feeling towards my solution (and the contrast
you create with your 'natural one'); got it! but then I invite you to
explore scan with \G; look at this, that may be doing something more
'natural':

> # \G 'anchors' start of next search to end of previous one
re_prefix = %r/\G (\d+ [.]?) /x
input.each { |line| p line.scan(re_prefix).flatten }

> Small (1 line!), fast, precise: a beauty.

I agree fully!

Of course I couldn't leave "well enough" alone,  so here's my mod:

input.each { |line| line.scan(re_prefix).flatten.each { |e|
    printf("%s  ",e)}; puts }


> Perhaps, examine \G and/or StringScanner, ...

I took a fast look at ruby-doc.org/core/ ... looks good. Thanks

> see if you can find a
solution that meets what you are looking for, without (as seen from
me)
imperfections.

Your latest approach suits my requirement (and taste) perfectly.  I'm
off now to continue work on the project I'm developing, which you
might find interesting.  Since it's off-topic, send me an email if you
want details.  (My email-address looks artificial in order to deter
spammers,  but I do have a mail box for it which I only check
sporadically unless I anticipate legitimate email.)


>  Some people, when confronted with a problem, think:
  "I know, I'll use regular expressions".
  Now they have two problems.

:BG

Again, thank you and
Best Wishes,
Richard