Printing

hi

im trying to:
# open a .txt file and read all the lines in the file
# run a regular expression to find in the form of (some text) (then
anything in [])(some text)
# iterate through each line in the file until no references left

i have achieved the following but i want to print out the references

im unsure how to do this.
any help would be much appreciated
iv provided my code below

thanks

ruby class:

  File.open('testnew.txt').each do |line|
    if line =~ /(.*?)\[(.*?)\](.*)/
  end

  puts

.txt file - i know it doesnt make any sense

uhvbguyfgtyftyf [ref1] jhvbufgytf [ref2, ref1]
jhvytfdr [ref2]

···

--
Posted via http://www.ruby-forum.com/.

File.open('testnew.txt').each do |line|
  if line =~ /(.*?)\[(.*?)\](.*)/
    puts line
  end
end

···

On Dec 10, 4:42 pm, Johnathan Smith <stu...@hotmail.com> wrote:

im trying to:
# open a .txt file and read all the lines in the file
# run a regular expression to find in the form of (some text) (then
anything in )(some text)
# iterate through each line in the file until no references left

i have achieved the following but i want to print out the references

im unsure how to do this.
any help would be much appreciated
iv provided my code below

ruby class:

  File.open('testnew.txt').each do |line|
    if line =~ /(.*?)\[(.*?)\](.*)/
  end