RegEx street adress without "letters"

I have theese danish adress’ i need to split/Use regex on.

On the left i have an example of the adress and on the right, the adress i want to return:

Testvej 101a th - Testvej 101
Testvej 101a, 1 th - Testvej 101
Testvej 101, 25 - Testvej 101
Testvej 101. 25a th - Testvej 101
Testvej 1 a th - Testvej 1
St. Testvej 234a - St. Testvej 234
Gl. større Testvej 1 tv - Gl. større Testvej 1

So i need to remove everything after the street name and house number, i need some guidance on how to do this.

Hi @eltmo

Can you share the Expected Output here

Regards
Gokul

Hi @eltmo,

Try below regex pattern
^\w* [0-9]*

Regards,
Arivu

The expected output is on the right

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"^[.\w\s]+?\d+").Value

Regards,

Thank you, but i need it for all the examples.

Hi @eltmo,

Try this
^\D*[0-9]*

Refer below link

Regards,
Arivu

It worked on a lot of mathes but i came upon this one, Test. X’s vej 2, 6. th. - where it dosnt work

Hi,

How about the following?

System.Text.RegularExpressions.Regex.Match(yourString,"^.+?\d+").Value

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.