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 7085175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:23:32+00:00 2026-05-28T07:23:32+00:00

I try to find addresses in different texts. It works quite well except that

  • 0

I try to find addresses in different texts. It works quite well except that it also matches a word followed by a date (foobar 22.01.2012 => address: foobar 22)
So I would like to improve the regex in a way that a streetnumber MUST NOT be followed by “(.|:)\d”

This is what I have:

(?<str>\b([a-zA-Z]+-*[a-zA-Z]+(-|\s)*([a-zA-Z]|-)+)\b\.?\s{1})(?<no>\d+(\s?[a-zA-Z])?\b)

A representative text:

Consultation hours
Monday, the 06.02. until Friday, the 10.02.2012 and
Monday, the 13.02. until Tuesday, the 14.02.2012,
each 14.00-15.30 o’clock, second floor,
Am Fasanengarten 12 foobar
Schlossstr. 34

What should be found?
Am Fasanengarten 12
Schlossstr. 34

What is found?
the 06
the 10
the 13
the 14
each 14
Am Fasanengarten 12
foobar // why is this a match? Without number?
Schlossstr. 34

I tried different positive/negative lookbehinds/-aheads but with no luck.

  • 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-28T07:23:33+00:00Added an answer on May 28, 2026 at 7:23 am

    Try this here

    (?<str>\b(?:[a-zA-Z]+-*[a-zA-Z]+(?:[ \t-])*(?:[a-zA-Z]|-)+)\b\.?\s)(?<no>\d+(?:\s?[a-zA-Z])?\b)(?![.:]\d)
    

    See it here on Regexr

    The negative lookahead (?![.:]\d) at the end assures, that there is no “.” and no “:” followed by \d ahead.

    foobar // why is this a match? Without number?
    Schlossstr. 34

    This is a match because you allow \s between the words of the streetname

    (?<str>\b([a-zA-Z]+-*[a-zA-Z]+(-|\s)*([a-zA-Z]|-)+)\b\.?\s{1})(?<no>\d+(\s?[a-zA-Z])?\b)
                                     ^^ here
    

    I replaced this in my solution with [ \t-], this allows only space, Tab and hyphen.

    \s is “Whitespace” and this contains also the line brake characters, because of this it matches the foobar, if you would have looked at the group, you would have seen, that it matches the address “foobar Schlossstr. 34”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used DLL Export viewer to try and find the functions that are
I looked through the related questions and couldn't find anything that addresses exactly what
Having an annoying small problem. Cannot find the solution that works tried just about
I really try to find on google how can we convert .doc and .txt
When I try to find out the total count of delicious bookmarks, Delicious returns
I have been through every option to try to find a way to get
I have an Java AST and I try to find a variable inside it
just to put it out there -I really did search and try to find
Perhaps I'm not using the right terminology, but I'm struggling to try to find
When I create a dynamic image on a canvas, and then try ti find

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.