Dave Thomas wrote:
>
>"Ben Tilly" <ben_tilly / hotmail.com> writes:
>
> > Well everything in it is going to be fairly easy to translate
> > except the ability to loop over matches of an RE.
>
>Would String#scan do what you want (sorry, but I gave up reading
>through all the code on the page you referenced)?

Not a chance.  The key bit of code is the function at the
very end.  It is based on passing the string around
between a loop and various handlers, each of which picks
up matching where the last left off.  The result is to
take a markup language that looks a lot like a strict
subset of html and put out validated html, with inserted
messages about various things that look like mistakes
(for instance trying to close a tag you didn't open).

The exact markup language can be modified easily, and
likely would depend upon a user's preferences...

>    "the cat in the hat".scan(/.[aeiou]./) do |match|
>      puts match
>    end
>
>
>    he
>    cat
>     in
>    he
>    hat
>
>
>http://www.rubycentral.com/ref/ref_c_string.html#scan
>
Been there.  Until my copy of your book is delivered I
will be visiting that site a lot. :-)

Cheers,
Ben
_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com