s00ny5 0 Posted October 7, 2017 Report Share Posted October 7, 2017 Hello, I have a website that return a plain txt example: RESULT|03AJzQf7NGfeGGTfVYRW5FD I need the text after RESULT| to set as a variable 03AJzQf7NGfeGGTfVYRW5FD tried: set(#asd,$page scrape("RESULT|",""),"Global") set(#asd,$page scrape("RESULT|","*"),"Global") set(#asd,$page scrape("RESULT|","{*}"),"Global") nothing worked .. any idea ? Regards Quote Link to post Share on other sites
s00ny5 0 Posted October 7, 2017 Author Report Share Posted October 7, 2017 ok... I managed to do this with javascript by injecting at the end a span. function appendHtml(el, str) { var div = document.createElement('div'); div.innerHTML = str; while (div.children.length > 0) { el.appendChild(div.children[0]); } } var html = '<span>Finish</span>'; appendHtml(document.body, html); Regards Quote Link to post Share on other sites
Marani 80 Posted October 7, 2017 Report Share Posted October 7, 2017 Regex could be a much better choice for this: (?<=\|).* 1 Quote Link to post Share on other sites
HelloInsomnia 1103 Posted October 7, 2017 Report Share Posted October 7, 2017 Like Marani said regex is a good choice, I made the code for it and also for a second way as well which just uses a list with the pipe | as the delimiter. In this case regex is probably better because its less code but in the future if you run into this same problem with another thing and don't know regex then you can easily just use the second method instead: set(#text,"RESULT|03AJzQf7NGfeGGTfVYRW5FD","Global") comment("First way") set(#result,$find regular expression(#text,"(?<=\\|).*"),"Global") comment("Second way") clear list(%result) add list to list(%result,$list from text(#text,"|"),"Delete","Global") set(#result2,$list item(%result,1),"Global") Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.