re = /([(\w|N°|#|.\s]+\d+)/
str = 'Colón N° 346 (Entre 21 de Mayo y Sotomayor)
Diego Portales Nº2291
Av. Pedro Aguirre Cerda N° 1010
Tarapaca N° 729
Local 3 A 1er. Piso, Centro de Convenciones Zofri
Av. Héroes de la Concepción Nº 2653
Cerro Esmeralda 3130
Mall Calama, Balmaceda N° 3242 Local S-08
Av. Chorrillos # 1759 Local 1082 Exterior Jumbo
Av. Balmaceda N° 2355 Local BS - 121 / Subterráneo sector servicios
Av. Balmaceda N° 2337 - Local 2
Angamos N° 610 (Interior Universidad)
'
# 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