Dave Thomas <Dave / PragmaticProgrammer.com> wrote:
>
>"Ben Tilly" <ben_tilly / hotmail.com> writes:
>
> > matz / zetabits.com (Yukihiro Matsumoto) wrote:
> > >
[...]
> > Yup.  Then you can duplicate an RE exactly with:
> >
> >   new_re = Regexp.new(re.source, re.options, re.kcode.to_s)
>
>Although it would also be nice to have
>
>     new_re = Regexp.new(re)
>
>(as well as the more prosaic new_re = re.dup)

I am trying to figure out why you would want to
duplicate an RE exactly.  Is it so you can have
multiple matches stored?

In my case I want to create a new one that differs
from the old very slightly.  I can (well wanting to
do that I *really* can) see why that is handy.  But
the uses for an exact duplicate is almost achieved
by

  new_re = re


???

Cheers,
Ben
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com