J
John Smith
Hi everyone,
I'm trying to build a program that filters
certain lines through regular expressions.
In the seconde regular expression I wan to
be able to print only what's within the
\(\w+\) part of the expression?
How do I do this?
counter = 0
if inFile.nil? == false
File.foreach(inFile) do |line|
if line =~ /^[^%\s*^%]/
if line =~ /(?!%)\w+\s+\(\w+\)/
puts "found in line #{counter+1} "
puts line
end
end
counter = counter + 1
end
end
Regards,
Ted.
I'm trying to build a program that filters
certain lines through regular expressions.
In the seconde regular expression I wan to
be able to print only what's within the
\(\w+\) part of the expression?
How do I do this?
counter = 0
if inFile.nil? == false
File.foreach(inFile) do |line|
if line =~ /^[^%\s*^%]/
if line =~ /(?!%)\w+\s+\(\w+\)/
puts "found in line #{counter+1} "
puts line
end
end
counter = counter + 1
end
end
Regards,
Ted.