il Sun, 11 Jul 2004 19:14:19 +0200, Dirk Einecke <dirk.einecke / gmx.de>
ha scritto::

maybe like this?
>> tag2='miao'
=> "miao"
>> '<html>miao</html>'.gsub(/<#{tag}>.*?<\/#{tag}>/, '<'+tag2+'>foo</'+tag2+'>')
=> "<miao>foo</miao>"

otherwise you could use Regexp.compile:

>> Regexp.compile tag+'.*?'+tag
=> /html.*?html/

or Regexp.new
>> Regexp.new tag+'.*?'+tag
=> /html.*?html/

but, would'nt it be easier to do:

gsub /<\/?#{tag}>/, tag2

?