> In any case, what did you need this for?

I assume you mean having the class respond to methods that match a regexp?

So you can have a user input commands without having to type the whole
command.  Also for having aliases for commands without having to write each
method to call the main method.

class foo
  def /[ls|dir|directory]/
  end
  def /desc.*/
  end
end

foo.ls
foo.dir
foo.directory

foo.desc
foo.describe

Personally I think its kinda neat.  I love the power of regular expressions.
Not to mention that the regexp is data and so can be read at runtime from a
database/file.  I know that due to this layer of indirection that it will
make execution slower, but thats what faster machines are for ;-)

John.

"Mike Campbell" <michael_s_campbell / yahoo.com> wrote in message
news:NFBBKBEMGLGCIPPFGHOLMEIICJAA.michael_s_campbell / yahoo.com...
> > Would it be possible to see if a regular expression intersects with
another
> > regular expression, and if so not add the one that overlaps?
>
> it might be possible, but damned difficult.
>
> It's been too long since my CS days, but something about that makes me
think
> it's ... not, at least not with any sort of reasonable time.  But I have
doubts
> of my doubt, too, so...
>
> In any case, what did you need this for?  In 15 years of professional
> programming (granted, not all of it OOP), I can't think of a case where I
would
> have even considered this to be a solution to a problem.  But I haven't
seen all
> the problems there are yet, so I'm sure I'm missing a few.  =)
>
>