From: Dirk Einecke Date: 2004-07-12T02:32:26+09:00 Subject: Re: Syntax question for gsub Hi. Marcin Miel�y�ski wrote: > Dnia 2004-07-11 19:14, U�ytkownik Dirk Einecke napisa�: > >> But how can I insert the var 'tagName' in the first part >> ( /(.*?)<\/html>/ ) >> ? >> >> Can anybody help me with this small problem? > > try: > > gsub!( /<(.+)>(.*?)<\/\1>/ ) { "<#{$1}>foo" } > > or even: > > gsub!( /<(.+)>(.*?)<\/\1>/,'<\1>foo<\1>' ) But this is only working for the tag "html". If I wont to use an other tag (like "title" or "head") I can not use your solution. :( greetings Dirk Einecke