$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';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php