Ruby on Rails
Tuesday, February 5, 2019
In this regex on line 5 everything between the parentheses will be returned as the match array? Right now it fails with TypeError: no implicit conversion of nil into String
doc=Nokogiri::HTML.parse(file)
doc.css("script").each do |s|
if s.text=~/skuProducts/
js_string = s.text
data = js_string[/\[,(.+?)\]/, 1]
parsed_data = JSON.parse(data)
end
end
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ba226e4c-b2b0-4e12-b6a4-1e8dcebe2c21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment