From: Hal Fulton Date: 2006-04-06T08:18:21+09:00 Subject: Re: Copying $1.. A loop with two regular expressions Oky wrote: > 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 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. Are you trying to use a command line argument? If so, try ARGV[1] instead of $1 (which is a global variable storing the text of the first subexpression in the most recent match. Hal