From: Randy Lawrence Date: 2004-07-12T08:23:45+09:00 Subject: Re: Syntax question for gsub Dirk Einecke wrote: > Hi. > > I've a litte syntax question. I read a HTML file and change all between > the html tag: > > fileContent.gsub!( /(.*?)<\/html>/ ) { 'foo' } > > Now I want to set the tag type dynamicly like this: > > tagName = 'html' > fileContent.gsub!( /(.*?)<\/html>/ ) { > '<'+tagName+'>foo' } > > But how can I insert the var 'tagName' in the first part > ( /(.*?)<\/html>/ ) > ? > > Can anybody help me with this small problem? > > greetings > Dirk Einecke I just came across a few regex resources on the web today so I'll post: Example Regex Expressions (Markup Category) http://www.regexlib.com/DisplayPatterns.aspx?cattabindex=4&categoryId=8 Regex Cheatsheet (useful despite being .NET) http://www.regexlib.com/CheatSheet.htm Regex Coach (free/donationware) GUI tool for both Linux and Windows http://weitz.de/regex-coach/