matz / zetabits.com (Yukihiro Matsumoto) wrote:
>
>Hi,
>
>In message "[ruby-talk:10435] Re: Recall Regexp options?"
>     on 01/02/07, "Ben Tilly" <ben_tilly / hotmail.com> writes:
>
>|>I'll fix it soon.
>|
>|Thank you, and if you make the options available as an
>|attribute of Ruby, I will be most grateful.
>
>I will do this too.  Do you think Regexp#options is a good name for
>the method?
>
Yup.  Then you can duplicate an RE exactly with:

  new_re = Regexp.new(re.source, re.options, re.kcode.to_s)

The .to_s there looks funny, but it is required because the
optional (third) argument defaults to '', which results in
a kcode of nil, and if you try to use that again it refuses
to be coerced into a string.

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