re = /(?i)^.*\.(.*\.[a-z]{0,3})|(?i)([a-z]{0,3}\..*\.[a-z]{0,3}|.*\.[a-z]{0,3})$$/m
str = 'ch.iqos.com
discoveriqos.com
faramentol.ro
foodhouse.md
futurosinhumo.com
ganaconpmi.com
getinfo.kr
heatnotburn.se
iqommunity.ro
iqosclub.cz
iqosclub.sk
iqosclubcanarias.com
iqosempfehlen.at
iqositalia.it
iqosphere.jp
iqossvc.kr
iqosveda.cz
iqosveda.sk
newcreations.kr
prohibicionmentolado2020.es
proibicao-mentol2020.pt
qreator.ro
referiqosmy.com
shareiqos.ch
timeforchanges.ch
tryiqos.kr
unsmoke.de
iqostravel.com
iqostage.jp
iqos-register.jp
mystartapp.org
iqosclub.ch
dimensions.kz
www.tryiqos.ru
www.timeforchanges.ch
www.testiqos.ch
readmodel.m.sogou.com
www.shareiqos.ch'
# 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