Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3617260
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:36:05+00:00 2026-05-18T22:36:05+00:00

Hey, I was wondering how I can find a Street Address in a string

  • 0

Hey,
I was wondering how I can find a Street Address in a string in Python/Ruby?

Perhaps by a regex?

Also, it’s gonna be in the following format (US)

420 Fanboy Lane, Cupertino CA

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:36:05+00:00Added an answer on May 18, 2026 at 10:36 pm

    Using your example this is what I came up with in Ruby (I edited it to include ZIP code and an optional +4 ZIP):

    regex = Regexp.new(/^[0-9]* (.*), (.*) [a-zA-Z]{2} [0-9]{5}(-[0-9]{4})?$/)
    addresses = ["420 Fanboy Lane, Cupertino CA 12345"]
    addresses << "1829 William Tell Oveture, by Gioachino Rossini 88421"
    addresses << "114801 Western East Avenue Apt. B32, Funky Township CA 12345"
    addresses << "1 Infinite Loop, Cupertino CA 12345-1234"
    addresses << "420 time!"
    
    addresses.each do |address|
      print address
      if address.match(regex)
        puts " is an address"
      else
        puts " is not an address"
      end
    end
    
    # Outputs:
    > 420 Fanboy Lane, Cupertino CA 12345 is an address  
    > 1829 William Tell Oveture, by Gioachino Rossini 88421 is not an address  
    > 114801 Western East Avenue Apt. B32, Funky Township CA 12345 is an address  
    > 1 Infinite Loop, Cupertino CA 12345-1234 is an address  
    > 420 time! is not an address  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I'm using python and I was just wondering how we can make
Hey guys & girls, Im wondering how I can find the object count of
Hey Just wondering how the following can happen Object reference not set to an
Hey all, I am wondering what the best way to do the following is:
Hey, I was wondering if anybody knew how to alter the following XSL stylesheet
Hey there, was wondering if anyone could help a newbie on SQL and Python.
Hey everyone, got a quick question that I can't seem to find anything about...
Hey I'm wondering how I can get this code to work. Basically I want
Hey everyone! I was wondering how the methods in Ruby that aren't called with
Hey so I'm making a factoring program and I'm wondering if anyone can give

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.