From: Jon Date: 2007-03-30T06:46:01+09:00 Subject: Regex problem... Tried Searching forum already... :( I absolutely cannot figure out why this does not find a match! I tried searching this forum before I posted... I've been stuck for hours on such a simple problem... I feel retarded. lines is an array of strings: def go(lines) reg=/\[trace\-(\d+)\]/ lines.each do |line| puts line.slice!(0,25) #speed... some lines are long puts reg.match(line)[1] end end Here is an example string: [trace-2932] Application=3071000 I get this: undefined method `[]' for nil:NilClass (NoMethodError) on the reg.match[1] line. thanks for looking -- Posted via http://www.ruby-forum.com/.