The three rules of Ruby Quiz:

1.  Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.

2.  Support Ruby Quiz by submitting ideas as often as you can:

http://www.rubyquiz.com/

3.  Enjoy!

Suggestion:  A [QUIZ] in the subject of emails about the problem helps everyone
on Ruby Talk follow the discussion.  Please reply to the original quiz message,
if you can.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

by Benjohn Barnes

Usually, you write a regular expression and then search for it in a text string.
How about doing the opposite? Given a regular expression, generate all of the
strings that it will match.

Rather amazingly, this has independently come up a couple of times in
conversations with friends, so perhaps it's actually useful. I wanted to use it
to specify possible domain names for a potential new company...

	/(lovely|delicious|splendid)(food|snacks|munchies)/.generate
	=> [lovelyfood, deliciousfood, splendidfood,
	    lovelysnacks, delicioussnacks, splendidsnacks,
	    lovelymunchies, deliciousmunchies, splendidmunchies]

The full regular expression grammar is pretty complex, so maybe you'll want to
just go with a small subset. :-)