CJ M. wrote in post #1053266:
> I'm very new to coding of any kind, and I'm trying to learn Ruby by

Welcome to the world of Ruby - and programming!

> working through some projects that are relevant to me. I'm working on a
> small project to pull the headlines out of a news website for me. I'm
> able to get match working just fine. I've tried switching to string.scan
> to be able to iterate and nothing is returned. I can't figure out why
> not, and would appreciate suggestions.

> page_string='junk'
> open("http://www.scatoday.net/") {|f|
>    page_string = f.read
>   }

You could simply do

page_string = open("http://www.scatoday.net/") {|f| f.read}

or even this if you want to get fancy

page_string = open("http://www.scatoday.net/", &:read)

> #THIS one works, one time
>  #rezstring = /\/node\/[0-9]+.*title=".*">/.match(page_string)
> #THESE Don't
> #page_string.scan(/\/node\/[0-9]+.*title=".*">/)

What does "does not work" mean?  I get 80 matches.

> #page_string.gsub(/\/node\/[0-9]+.*title=".*">/)

This cannot work since you either need a second argument or a block.
Please post error messages or a more clear description of what you think
does not work.

Btw, it seems for what you do Mechanize could be a good tool.
http://mechanize.rubyforge.org/

Kind regards

robert

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