clintk 2 Posted July 9, 2019 Report Share Posted July 9, 2019 Is it possible to use a wildcard in search page?I saw this question was asked in 2010 and they were told it was on the todo list, surely it must have been done by now? I do keep setting myself these tasks for no other reason other than learning Ubot but I won't stop until I find a way to achieve it. :-)Here's what I want to do:- Navigate to a web page.....simplesearch the web page for a keyword...should be simple BUT I want to return true if part of the word exists. For instance, if the keyword was fox I want to return true if the word foxtail existed, basically I want to be able to use the keyword with wildcards such as *fox* I won't ask can it be done because anything is possible, i will ask which of you highly intelligent people know how to do it.I find flattery works well :-)Looking forward to the suggestions because I've tried all day and cannot fathom it out!Thanks,Clint Quote Link to post Share on other sites
pash 504 Posted July 9, 2019 Report Share Posted July 9, 2019 tryhttps://wiki.ubotstudio.com/wiki/Contains navigate("http://www.ubotstudio.com/resources","Wait") alert($contains($document text,"ubot")) 1 Quote Link to post Share on other sites
clintk 2 Posted July 9, 2019 Author Report Share Posted July 9, 2019 Thanks, I'll have a look. :-) Quote Link to post Share on other sites
clintk 2 Posted July 9, 2019 Author Report Share Posted July 9, 2019 It was worth a try but that seems to only accept complete word and no wildcard :-( Quote Link to post Share on other sites
pash 504 Posted July 9, 2019 Report Share Posted July 9, 2019 navigate("http://www.ubotstudio.com/resources","Wait") alert($comparison($find regular expression($document text,"UBot.*?Stealth"),"!= Does not equal","")) 2 Quote Link to post Share on other sites
clintk 2 Posted July 9, 2019 Author Report Share Posted July 9, 2019 Brilliant! thanks Pash Quote Link to post Share on other sites
HelloInsomnia 1103 Posted July 9, 2019 Report Share Posted July 9, 2019 Contains should work, you don't need a wildcard. For example: set(#text,"HereIsSomeText","Global") set(#contains,$contains($change text casing(#text,"Lower Case"),"some"),"Global")Unless you wanted to control where it is in the word (such as start or end or middle for example) then you would need to use regex. Quote Link to post Share on other sites
clintk 2 Posted July 9, 2019 Author Report Share Posted July 9, 2019 Contains should work, you don't need a wildcard. For example: set(#text,"HereIsSomeText","Global") set(#contains,$contains($change text casing(#text,"Lower Case"),"some"),"Global")Unless you wanted to control where it is in the word (such as start or end or middle for example) then you would need to use regex.I still can't get that to work HelloInsomnia,Could you possibly put it into a script for me that does this:- navigates to a webpagelooks for a word that is inside another word eg, searches for sox when the word redsox exists and returns true.If there isn't sox anywhere on the page return false. It seems such a simple thing but I can't get my head around it.TIAClint Quote Link to post Share on other sites
clintk 2 Posted July 9, 2019 Author Report Share Posted July 9, 2019 Ok, I got it!Thanks for your help everyone ! Quote Link to post Share on other sites
HelloInsomnia 1103 Posted July 9, 2019 Report Share Posted July 9, 2019 Glad to hear you got it but I'll post an example anyways for those who find this thread later: set(#textToSearchFor,"ant","Global") comment("This archived page should always be the same") navigate("https://web.archive.org/web/20190709075034/https://en.wikipedia.org/wiki/Coffee","Wait") set(#textUnderPicture,$scrape attribute(<class="infobox hrecipe hproduct">,"innertext"),"Global") if($contains($change text casing(#textUnderPicture,"Lower Case"),$change text casing(#textToSearchFor,"Lower Case"))) { then { alert("The page contains {#textToSearchFor}") } else { alert("The page DOES NOT contain {#textToSearchFor}") } } 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.