I have an array of links from a webpage. I need to clean up the links
so it only has city links in it. So I do a .each and test for regex.
page.links.each{
if link.text =~ /(Blog|About Us|Status|Help|TOS|Privacy|Are we missing
an area?)/
page.links.delete(link)
end
end
For some reason the deleting of a link/element causes it to skip the
next link/element
in the array the last 7 links are
About us
Blog
Status
Help
TOS
Privacy
Are we missing an area?
but after running the .each on the array I still end up with
blog
help
privacy
if I run it again
help
lol, so why can't I do this on just one run threw with .each?
or why would deleting an element cause it to skip the next one.
I rebuilt it with an ugly while loop with a counter ..same problem
···
--
Posted via http://www.ruby-forum.com/.