Skip to content
Advertisement

Regex to extract (austrian) street housenumber/stairs/floor/door

I need to extract the housenumber with all the different constellations in austria:

JavaScript

I’ve already found this question: Regex to extract (german) street number.

This works if no stair/floor/door is entered. Can you help?

JavaScript

Advertisement

Answer

Not knowing Austrian address formats it’s hard for me to say if this is correct, however, please see the regex below.

JavaScript

This expression will always match all 4 number groups (1/2/3/4) so you will need to do some additional processing to determin if an address has a housenumber and stairs and floor and door, compared to if an address only has a housenumber and door.

For example:

JavaScript

Output

JavaScript

See here: http://sandbox.onlinephpfunctions.com/code/3952b2f3cab251e7137bcd9d55e42d8c8bcdd723

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement