We will start off in the test stack that you made, so that we can get the function working there before adding it to the WebScraper stack.
getLinks
to getText
; the rest of the script can remain the same.function getText pPageSource put replaceText(pPageSource,"(?:<(?P<tag>script|style)[sS]*?</(?P=tag)>)|(?:<!--[sS]*?-->)|(?:<[sS]*?>)","") into pPageSource replace lf with "" in pPageSource replace tab with " " in pPageSource return pPageSource end getText
PageText
.init
function:global gPageHTML on init if the platform is "iphone" or the platform is "android" then mobileControlSet "PageText","text",getText(gPageHTML) end if end init
This enormously long regular expression ran through the web page source and removed anything that was script, style, or just tag information, leaving the text parts alone. However, it would leave it with lots of spare line feed characters and tab characters, which we went on to remove using the LiveCode replace
function. The final text may not be perfect, but you can use the standard mobile text features to copy parts of the text for use in other apps.