Jump to content
UBot Underground

Regex Fails To Find Us Zip Code On Ubot?


Recommended Posts

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

Link to post
Share on other sites

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

Link to post
Share on other sites

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

Link to post
Share on other sites

nps

 

yeah it is the  (?i) remember to include the brackets

 

alert($find regular expression("Corsicana, Texas, United States 75110","(?i)(?<=.*states.)\\d+"))

Link to post
Share on other sites

I used:

^\d{5}(?:[-\s]\d{4})?$

 

This can handle

12345

12345-6789

12345 1234

 

Sources:
http://stackoverflow.com/questions/2577236/regex-for-zip-code
http://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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...