Getting all links of a webpage using Ruby

前端 未结 5 1400
盖世英雄少女心
盖世英雄少女心 2021-02-08 06:36

I\'m trying to retrieve every external link of a webpage using Ruby. I\'m using String.scan with this regex:

/href=\"https?:[^\"]*|href=\'https?:[^\         


        
5条回答
  •  北恋
    北恋 (楼主)
    2021-02-08 07:12

    Can you put groups in your regex? That would reduce your regular expressions to 1 instead of 2.

提交回复
热议问题