"Wild Karl-Heinz" <kh.wild / wicom.li> schrieb im Newsbeitrag
news:71430124625.20030616133402 / wicom.li...
> hello
>
> i know that it works,
> but not how :-)
>
> cat vcard | ruby parse.rb
>
> while vblk = ( /BEGIN:VCARD/ .. /END:VCARD/ )
>     ...
> end
>
> i whould need a hint.

A range operator with a regexp works like a flip flop (bistable multi
vibrator or so).  The value of the internal flag (and thus the result of
the evaluation) changes in this way: initiallly it's false.  If the first
RE matches it's switched to true. It stays true as long as the second RE
does not match.  If it does, the flag goes back to false.

while( line = gets )
  if /BEGIN:VCARD/ =~ line .. /END:VCARD/ =~ line
    puts line
  end
end

Regards

    robert