From: Robert Klemme Date: 2010-10-27T00:45:13+09:00 Subject: Re: Change captured values in a regexp On 26.10.2010 15:47, Bruno Sousa wrote: > Supposing there is a string like this: > Oct 22 06:25:35 machine kernel: [271182.956004] IN= OUT=eth0 > SRC=10.8.0.248 DST=192.5.5.241 > > I am using the following regexp to capture time: > /Oct (\d{2}) (\d{2}:\d{2}:\d{2})/ > > How can I alter the hour value only and keep it in the result returned? > I want to decrease 3 hours. > Instead of # > It should return # You don't want to mess with what the regexp match returns. Rather you need to process results afterwards. And please also consider the other comments. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/