Robert Klemme wrote: > Some more admittedly ugly constructions: > > val = "<165> Aug 16 17:01:35 localhost Just a test" > unless ( ( pri, timestamp, device, msg = * /^<(\d+)> \s+ (\S+ \s+ \d+ \s+ > \d+:\d+:\d+) \s+ (\S+) \s+ (.*)$/x.match(val).to_a ).empty? ) > puts "matched" > end > > pri, timestamp, device, msg = * /^<(\d+)> \s+ (\S+ \s+ \d+ \s+ \d+:\d+:\d+) > \s+ (\S+) \s+ (.*)$/x.match(val).to_a > if pri > puts "matched" > end > > LOG_RX = /^<(\d+)> \s+ (\S+ \s+ \d+ \s+ \d+:\d+:\d+) \s+ (\S+) \s+ (.*)$/x > > unless ( ( pri, timestamp, device, msg = * LOG_RX.match(val).to_a ).empty? ) > puts "matched" > end > > if ( line, pri, timestamp, device, msg = * /^<(\d+)> \s+ (\S+ \s+ \d+ \s+ > \d+:\d+:\d+) \s+ (\S+) \s+ (.*)$/x.match(val) ) && line > puts "matched" > end > > if ( line, pri, timestamp, device, msg = * LOG_RX.match(val) ) && line > puts "matched" > end > > :-) > > robert > *boom* That blow my mind away! No no, thanks a lot for that piece of code. But I prefer the scanf and one-line-regexp. I'll test which kind performs better for my needs. As I said, I'm a ruby newbie and personal programming rule is: keep it simple! ;) I've to understand the things I wrote. If the point is reached where my little script becomes interesting for others than me, I'll post an [Ann] thread. Bye, -- Daniel Vöěkerts :: "Ich habe einen Drachen, und ich WERDE ihn benutzen!" - Esel in Shrek