J
Jon
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
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