icoder 4 Posted March 28, 2015 Report Share Posted March 28, 2015 Hi,this is giving me a headache, i am trying to scrape US zip code using regex from a variable, but somehow it doesn't work on ubot! however it does work on notepad pro, not sure what i am missing set(#zip, $find regular expression("Corsicana, Texas, United States 75110", "\"(?<=.*states.)\\d+\""), "Global") please help! thanks Quote Link to post Share on other sites
deliter 203 Posted March 28, 2015 Report Share Posted March 28, 2015 my regex sucks but recently ive noticed the regex in ubot has become case specific,i would use editpad lite,and when that scenario happens i add (?i) to the start of my regex in ubot which usually works Quote Link to post Share on other sites
icoder 4 Posted March 28, 2015 Author Report Share Posted March 28, 2015 my regex sucks but recently ive noticed the regex in ubot has become case specific,i would use editpad lite,and when that scenario happens i add (?i) to the start of my regex in ubot which usually works still doesn't work, not sure what i am doing wrong set(#zip, $find regular expression("Corsicana, Texas, United States 75110", "?i(?<=.*states.)\\d+"), "Global") i have added the ?i but still no success thanks for the support deliter Quote Link to post Share on other sites
deliter 203 Posted March 28, 2015 Report Share Posted March 28, 2015 nps yeah it is the (?i) remember to include the brackets alert($find regular expression("Corsicana, Texas, United States 75110","(?i)(?<=.*states.)\\d+")) Quote Link to post Share on other sites
Bot-Factory 602 Posted March 28, 2015 Report Share Posted March 28, 2015 I used:^\d{5}(?:[-\s]\d{4})?$ This can handle1234512345-678912345 1234 Sources:http://stackoverflow.com/questions/2577236/regex-for-zip-codehttp://stackoverflow.com/questions/578406/what-is-the-ultimate-postal-code-and-zip-regex/12453440#12453440 But the first thing I would always do, look at the html elements. Maybe you can extract it via xpath. Dan 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.