スリ飯屋MaLankaのフリーエンジニアな日々
id:mah666hhh
【Rails】aタグからhref属性の値を正規表現で抽出する方法
href\s=\s"([^"]*)" という正規表現を使うことで実現可能です。 このstack over flowの回答がドンピシャでした。 > You should be able to use a regular expression like this: > href\s*=\s*"([^"]*)" See this Rubular example of that expression. > The capture group will give you the URL, e.g.: