Ruby on Rails Friday, December 28, 2018



On Friday, December 28, 2018 at 5:00:46 PM UTC-5, Colin Law wrote:
On Fri, 28 Dec 2018 at 21:40, fugee ohu <fuge...@gmail.com> wrote:
> ...
> I think I just need to strip the leading /**/jQuery18307882633047005491_1545805999753 from the result  /**/jQuery18307882633047005491_1545805999753({"success":true,"code":0,"results":[{"productId":32817749905,
> Anyone can help with the regex?

If you can't work out the regex just find the position of the first {
and strip to there.

Colin

I gsub'd for the first  ({

 json_data = res.body.gsub(/^.+\(\{/, "\(\{")
json = JSON.parse(json_data)
JSON::ParserError: 765: unexpected token at '({"success":true,"code":0,"results":[{"productId":32817

--
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/007843ea-8793-46fb-ab40-bf63e55fb2bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On Fri, 28 Dec 2018 at 21:40, fugee ohu <fugee279@gmail.com> wrote:
> ...
> I think I just need to strip the leading /**/jQuery18307882633047005491_1545805999753 from the result /**/jQuery18307882633047005491_1545805999753({"success":true,"code":0,"results":[{"productId":32817749905,
> Anyone can help with the regex?

If you can't work out the regex just find the position of the first {
and strip to there.

Colin

--
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/CAL%3D0gLsi4jY7g5Md1BGEnCNFO6nEW4mM-XUhX4WU_7%2B8MD0Mwg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Wednesday, November 7, 2018 at 10:35:01 AM UTC-5, fugee ohu wrote:
I'm not very good with the consoles in chrome and firefox but I couldn't find the text I was looking for in source even though it's displayed as text seemingly, the cursur changes to a vertical line on mouse-over I found this html below in the source How does this html create the text that displays?

   <div class="ui-box product-description-main" id="j-product-description">          <div class="ui-box-title">Product Description</div>          <div class="ui-box-body">                <div class="description-content" data-role="description" data-spm="1000023">              <div class="loading32"></div>              </div>            </div>      </div>

I think I just need to strip the leading /**/jQuery18307882633047005491_1545805999753 from the result  /**/jQuery18307882633047005491_1545805999753({"success":true,"code":0,"results":[{"productId":32817749905,
Anyone can help with the regex?

--
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/97351743-3274-4580-9ad6-0f67602cd0cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.