From: dblack@... Date: 2003-01-11T06:59:47+09:00 Subject: Re: regexp question Hi -- On Sat, 11 Jan 2003, Mark Probert wrote: > > David. > > Many thanks, once again. > > At 06:30 AM 1/11/2003 +0900, you wrote: > > >I would use String#gsub: > > :-) > > > > > s2 = s1.gsub(/\{\\(\S+)\s([^}]*)\}/) do |s| > > tag = subs[$1] || $1 > > "<#{tag}>#{$2}" > > end > > Ruby continues to amaze me! I didn't know that you > could do that. A much more elegant solution than mine. And you can make it even better by taking out that spurious "|s|" that I left in there :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav