次のような要素を取得しました。
<span class="narrowValue"> (15,728)</span>
私はこのようにスクレイピングしています:
@department_hash = Hash.new {|h,k| h[k]=[]}
department.css('.narrowValue').each do | department |
@department_hash["department"] << department.text
end
そして、次のような結果が得られます。
{"department"=>[" (15,725)", " (243,256)", " (510,337)", " (46,002)", " (14,109)", " (358)", " (5,787)", " (19,818)"]}
しかし、括弧は必要ありません。
数字だけを取得するにはどうすればよいですか?