Hi, sorry if this is a stupid question.. i've only been programming ruby 
for about six hours.

I'm trying to white a loop to parse through a webpage and get all the 
links to other pages. This loop depends on a regular expression to find 
all the <a href tags.. but inside the loop there is another regular 
expression which looks to see if the link is relative or static. The 
problem is the inner regular expression changes the $1 variable so the 
loop just fails on the first iteration. I've tried making a copy of the 
$1 variable but the result just ends up containing nil.

Any help you could offer would be gratefully appreciated

Hears my code so far:

    	loop do
    	 	url = $1
    		puts $1    #A url
    		puts $url  #Always nil ?

     		if $1 =~ /^http/  //Inner regular expression
    			new_url = host + path
    		else
    			new_url = path
    		end

    		newPage = WebPage.new(new_url, link_depth + 1)

    	break unless url =~ @@ahref_filter
    	end

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