On Nov 20, 5:04 ¨Âí¬ Óèåá Âáòôïî ¼ó®®®Àóùóáãè®ãïí÷òïôåº > I need to match a somewhat complicated match using gsub, then modify > part of it, leaving the rest intact > > for example, replacing > "url(http://www.google.com)" > with > "url(HTTP://WWW.GOOGLE.COM)" > > this is the closest answer I can come up with > gsub /(url\(['"]?)([^\)'"]+)(['"]?\))/, "\\1#{"\\2".capitalize}\\3" > or > gsub /(url\(['"]?)([^\)'"]+)(['"]?\))/, "\\1\\2.capitalize\\3" > but neither of these solutions work > > It doen't have to be with gsub, I just thought this would be the most > straightforward way > > ideas? > > thanks > > -- > Posted viahttp://www.ruby-forum.com/. "url(http://www.google.com)".sub( /\(.*?\)/ ){|s| s.upcase} ==>"url(HTTP://WWW.GOOGLE.COM)"