From: Florian Gross Date: 2004-09-21T03:39:38+09:00 Subject: Re: Ruby nuby -- modifying Regexp casefold Warren Brown wrote: >>Is there some trick to modify the casefold attribute of a Regexp >>object after it's been instantiated? > No, Regexps are immutable - you can't change them. Oh, you can: irb(main):001:0> re = /./; "hello world!".gsub(re) { |m| re.send(:initialize, /#{re}./); "<#{m}>" } => "d!" And that behavior is needed in some cases because there is no #to_regexp. And thank you for mentioning Regexp#source -- I didn't know about it yet. Regards, Florian Gross