From: Mark Date: 2004-02-07T05:05:28+09:00 Subject: Re: HowTo : sub.(regexp,$1) Bermejo, Rodrigo wrote: > Dear Ruby List: > > I'm trying to add one hr, to some time strings: > > "1:12:00" --> "2:12:00" (i don't need to worry about 24) > One way is to use the block form of gsub > Mi first try was ... > > "1:12:00".gsub(/(^\d?\w)/,$1.to_i.succ.to_s) instead use "1:12:00".gsub(/(^\d\w)/) {$1.to_i.succ.to_s) which gives "2:12:00" HTH Best Regards Mark Sparshatt