$re = '/\d+x\d+/';
$str = 'https://video.twimg.com/ext_tw_video/841791481534803968/pu/vid/320x180/egCAExYQdRBw08fb.mp4
https://video.twimg.com/ext_tw_video/841791481534803968/pu/vid/1280x720/GVsCGddpL9QoO4_B.mp4
https://video.twimg.com/ext_tw_video/841791481534803968/pu/vid/640x360/33qcUEzFw-WS0inJ.mp4
https://video.twimg.com/ext_tw_video/640x360/pu/vid/841791481534803968/33qcUEzFw-WS0inJ.mp4';
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