I saw an opportunity to take out the regexing here, my hope is that (without more thorough weird links test cases to know for sure) that Nokogiri will do a fine job of extracting the href's.