$re = '/https://internetinthecar-e2e\.((sfr|a1|swisscom|proximus|elisa|tango|telenor-no|telenor-se|yousee|plus|telia|bite-lv|bite-lt|a1-)\.)?iot\.vodafone\.com/sso/authorize/callback|https://internetinthecar-e2e-new\.iot\.vodafone\.com/sso/authorize/callback/m';
$str = '(https://internetinthecar-e2e.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.sfr.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.a1.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.swisscom.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.proximus.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.elisa.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.tango.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.telenor-no.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.telenor-se.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.yousee.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.plus.iot.vodafone.com/sso/authorize/callback|https://internetinthecar-e2e.telia.iot.vodafone.com/sso/authorize/callback)
https://internetinthecar-e2e.bite-lv.iot.vodafone.com/sso/authorize/callback
internetinthecar-e2e.bite-lt.iot.vodafone.com
internetinthecar-e2e.a1-si.iot.vodafone.com
internetinthecar-e2e.cyta.iot.vodafone.com
internetinthecar-e2e.elisa-ee.iot.vodafone.com
internetinthecar-e2e.epic.iot.vodafone.com
internetinthecar-e2e.a1-hr.vodafone.com
internetinthecar-e2e.a1-bg.iot.vodafone.com
';
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