$re = '/\[[0-9]+[;]?[1H\[K\[7mlines [0-9-]+ \[[0-9]+m\[60;1H\[60;1H/m';
$str = '[60;1H[K[7mlines 17464-17522 [27m[60;1H[60;1H[K 140.90.101.62-NOAA {
ip-netmask 140.90.101.62;
tag GLOBAL-WEATHER;
description "Weather - NOAA National Center for Environmental Prediction - Contact WCOC DSN 271-2586";
}
140.172.138.17-NOAA {
ip-netmask 140.172.138.17;
tag GLOBAL-WEATHER;
description "Weather - NOAA Operational Model Archive and Distro System (NOMADS-HTTPS) National Center for Environmental Prediction (NCEP-FTP) - Contact WCOC DSN 271-2586";
}
128.132.41.26-AFRL {
ip-netmask 128.132.41.26;
tag GLOBAL-WEATHER;
description "Weather - CAOC AF Research Lab - Contact WCOC DSN 271-2586";
}
140.172.138.18-NOAA {
ip-netmask 140.172.138.18;
tag GLOBAL-WEATHER;
description "Weather - NOAA Operational Model Archive and Distro System - HTTPS - Contact WCOC DSN 271-2586";
}
204.0.3.146 {
ip-netmask 204.0.3.146;
tag GLOBAL-WEATHER;
description "Weather - Intellicast - Contact WCOC DSN 271-2586";
}
192.145.239.17 {
ip-netmask 192.145.239.17;
tag GLOBAL-WEATHER;
description "Weather - Hurrtrack - Contact WCOC DSN 271-2586";
}
70.39.145.13 {
ip-netmask 70.39.145.13;
tag GLOBAL-WEATHER;
description "Weather - Hurrtrack - Contact WCOC DSN 271-2586";
}
204.0.3.147 {
ip-netmask 204.0.3.147;
tag GLOBAL-WEATHER;
description "Weather - Intellicast - Contact WCOC DSN 271-2586";
}
140.172.17.191-NOAA {
ip-netmask 140.172.17.191;
tag GLOBAL-WEATHER;
description "Weather - NOAA Aviation Weather Center - Contact WCOC DSN 271-2586";
}
140.90.200.191-NOAA {
ip-netmask 140.90.200.191;
tag GLOBAL-WEATHER;
description "Weather - NOAA Aviation Weather Center - Contact WCOC DSN 271-2586";
}
129.15.96.191-NOAA {
ip-netmask 129.15.96.191;
tag GLOBAL-WEATHER;
description "Weather - NOAA Aviation Weather Center - Contact WCOC DSN 271-2586";
}
23.3.96.193-NOAA {
ip-netmask 23.3.96.193;
tag GLOBAL-WEATHER;
description "Weather - NOAA - NWS Radar Sites - Contact WCOC DSN 271-2586";
[60;1H[K[7mlines 17523-17581 [27m[60;1H[60;1H[K }
205.156.4.51-NOAA {
ip-netmask 205.156.4.51;
tag GLOBAL-WEATHER;
description "Weather - NOAA - Web Map Service - Contact WCOC DSN 271-2586";
}
23.3.96.242-NOAA {
ip-netmask 23.3.96.242;
tag GLOBAL-WEATHER;
description "Weather - NOAA - NWS Radar Sites - Contact WCOC DSN 271-2586";
}
199.212.17.28 {
ip-netmask 199.212.17.28;
tag GLOBAL-WEATHER;
description "Weather - Canadian Weather - Contact WCOC DSN 271-2586";
}
199.212.17.39 {
ip-netmask 199.212.17.39;
tag GLOBAL-WEATHER;
description "Weather - Canadian Weather - Contact WCOC DSN 271-2586";
}
192.139.6.68 {
ip-netmask 192.139.6.68;
tag GLOBAL-WEATHER;
description "Weather - Canadian Northern Forestry Center - Contact WCOC DSN 271-2586";
}
140.90.101.79-NOAA {
ip-netmask 140.90.101.79;
tag GLOBAL-WEATHER;
description "Weather - NOAA NWS/NCEP TGFTP server - Contact WCOC DSN 271-2586";
}
140.90.101.34-NOAA {
ip-netmask 140.90.101.34;
tag GLOBAL-WEATHER;
description "Weather - NOAA NWS/NCEP FTP HPC Anony server - Contact WCOC DSN 271-2586";
}
140.90.101.132-NOAA {
ip-netmask 140.90.101.132;
tag GLOBAL-WEATHER;
description "Weather - NOAA NWS/NCEP Wind/Wave server - Contact WCOC DSN 271-2586";
}
140.172.138.79-NOAA {
ip-netmask 140.172.138.79;
tag GLOBAL-WEATHER;
description "Weather - NOAA NWS/NCEP TGFTP server - Contact WCOC DSN 271-2586";
}
140.90.213.161-NOAA {
ip-netmask 140.90.213.161;
tag GLOBAL-WEATHER;
description "Weather - NOAA NESDIS server - Contact WCOC DSN 271-2586";
}
140.90.195.198-NOAA {
ip-netmask 140.90.195.198;
tag GLOBAL-WEATHER;
description "Weather - NOAA National Center for Environmental Prediction - Contact WCOC DSN 271-2586";
}
140.90.192.168-NOAA {
ip-netmask 140.90.192.168;
tag GLOBAL-WEATHER;
[60;1H[K[7mlines 17582-17640 [27m[60;1H[60;1H[K description "Weather - NOAA National Center for Environmental Prediction - Contact WCOC DSN 271-2586";
}
128.118.28.249-PSU {
ip-netmask 128.118.28.249;
tag GLOBAL-WEATHER;
description "Weather - Penn State Uni Bufkit - apps2.meteo.psu.edu - Contact WCOC DSN 271-2586";
}
140.90.128.71-NOAA {
ip-netmask 140.90.128.71;
tag GLOBAL-WEATHER;
description "Weather - NOAA National Center for Environmental Prediction - Contact WCOC DSN 271-2586";
}
140.90.88.142-NOAA {
ip-netmask 140.90.88.142;
tag GLOBAL-WEATHER;
description "Weather - NOAA National Center for Environmental Prediction - Contact WCOC DSN 271-2586";
}
140.90.33.41-NOAA {
ip-netmask 140.90.33.41;
tag GLOBAL-WEATHER;
description "Weather - NOAA National Center for Environmental Prediction - Contact WCOC DSN 271-2586";
}
140.90.33.31-NOAA {
ip-netmask 140.90.33.31;
tag GLOBAL-WEATHER;
description "Weather - NOAA National Center for Environmental Prediction - Contact WCOC DSN 271-2586";
}
144.183.222.21 {
ip-netmask 144.183.222.21;
}
144.183.32.21 {
ip-netmask 144.183.32.21;
}
199.124.100.0_22 {
ip-netmask 199.124.100.0/22;
}
199.124.104.0_23 {
ip-netmask 199.124.104.0/23;
}
199.124.96.15-199.124.96.18 {
ip-range 199.124.96.15-199.124.96.18;
}
199.225.7.15 {
ip-netmask 199.225.7.15;
}
214.2.155.12-214.2.155.231 {
ip-range 214.2.155.12-214.2.155.231;
}
214.2.2.245 {
ip-netmask 214.2.2.245;
}
214.2.2.246 {
ip-netmask 214.2.2.246;
}
214.2.90.222 {
ip-netmask 214.2.90.222;
}
134.11.168.17 {
ip-netmask 134.11.168.17;
[60;1H[K[7mlines 17641-17699 [27m[60;1H[60;1H[K description "Pentagon Army ROVR destination";
}';
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