mamica 10 Posted November 4, 2014 Report Share Posted November 4, 2014 set(#phone, $find regular expression(#contactscrape, "(\\s*\\(?0\\d4\\)?\\s*\\d6\\s*)|(\\s*\\(?0\\d3\\)?\\s*\\d3\\s*\\d4\\s*)"), "Global")So this is my code in ubot, but it is not working, my phone variable is blank and on www.rubular.com when i test this regex: (\s*\(?0\d4\)?\s*\d6\s*)|(\s*\(?0\d3\)?\s*\d3\s*\d4\s*) I match UK Numbers from this page: http://www.hollywoodcinemas.net/norwich-contact please help. why www.rubular.com match the numbers and inside bot i dont get result. Quote Link to post Share on other sites
UBotDev 276 Posted November 4, 2014 Report Share Posted November 4, 2014 It doesn't work because your regex is totally broken (it must have changed while you were adding it to UBot). Found a random regex for UK phone numbers and it works: set(#phone, $find regular expression($scrape attribute(<tagname="html">, "innertext"), "(??:\\(?(?:0(?:0|11)\\)?[\\s-]?\\(?|\\+)44\\)?[\\s-]?(?:\\(?0\\)?[\\s-]?)?)|(?:\\(?0))(??:\\d\{5\}\\)?[\\s-]?\\d\{4,5\})|(?:\\d\{4\}\\)?[\\s-]?(?:\\d\{5\}|\\d\{3\}[\\s-]?\\d\{3\}))|(?:\\d\{3\}\\)?[\\s-]?\\d\{3\}[\\s-]?\\d\{3,4\})|(?:\\d\{2\}\\)?[\\s-]?\\d\{4\}[\\s-]?\\d\{4\}))(?:[\\s-]?(?:x|ext\\.?|\\#)\\d\{3,4\})?"), "Global") 1 Quote Link to post Share on other sites
mamica 10 Posted November 5, 2014 Author Report Share Posted November 5, 2014 thanks this is working. Quote Link to post Share on other sites
mamica 10 Posted November 18, 2014 Author Report Share Posted November 18, 2014 Can i merge US and UK phone numbers if i use | or is there some other character that i can sue as or. So for exampleUk regex code|US regex code Will this make it to check first for UK phone numbers and then after that for US phone numbers or i missunderstand something? Quote Link to post Share on other sites
UBotDev 276 Posted November 18, 2014 Report Share Posted November 18, 2014 You could use something like that yes. Else Google knows everything...http://lmgtfy.com/?q=uk+us+phone+regex 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.