re = /^([A-ZÄäÖöÜüß.\s-]+?)\s*(\d+(?:[\/-]\d+)?(?:[A-Z](?:-[A-Z])?)?)\b/mi
str = 'Berliner Str. 74
Hindenburgdamm 27, Hygiene-Institut
Peschkestr. 5a/Holsteinische Str. 44
Lankwitzer Str. 13-17a
Fidicinstr. 15A
Johanna-Stegen-Strasse 14a-d
Friedrichshaller Str. 7
Haudegen Weg 15/17
Südwestkorso 9'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html