$re = '/^[0-9]{1,3}.[0-9]{1,3}/m';
$str = '103.145.72.0/24 Alibaba.com HK(Kaopuyun) 256
110.76.21.0/24 Zhejiang Ant Small And Micro Financial Services 256
122.254.76.0/23 Internet Global (group) Co., LTD 512
116.251.120.0/22 Zhejiang Taobao Network Co.,Ltd 1,024
149.129.16.0/23 Alibaba.com Singapore E-Commerce Private Limited 512
8.209.96.0/19 Westendstrabe 28, 60325 Frankfurt am Main 8,192';
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