<?
$pattern="/(\d+)\.(\d+)\.(\d+)\.(\d+)/";
$string="Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 192.168.14.0/24 anywhere
ACCEPT all -- 192.168.0.10 anywhere MAC 00:01:6C:F0:47:8A
ACCEPT all -- 192.168.0.246 anywhere MAC 00:0D:87:8F:FD:38
ACCEPT all -- 192.168.0.247 anywhere MAC 00:0D:87:C4:85:E8
ACCEPT all -- 192.168.0.248 anywhere MAC 00:90:27:99:26:64
ACCEPT all -- 192.168.0.249 anywhere MAC 00:02:C5:08:BA:E7
ACCEPT all -- 192.168.0.250 anywhere MAC 00:A0:D1:E0:66:A7
ACCEPT all -- 192.168.0.251 anywhere MAC 00:10:5C:AC:D6:90
ACCEPT all -- 192.168.0.253 anywhere MAC 00:D0:B7:C6:8E:F3 ";
preg_match($pattern, $string, $match);
echo($match);
?>应该可以吧?
$pattern="/(\d+)\.(\d+)\.(\d+)\.(\d+)/";
$string="Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 192.168.14.0/24 anywhere
ACCEPT all -- 192.168.0.10 anywhere MAC 00:01:6C:F0:47:8A
ACCEPT all -- 192.168.0.246 anywhere MAC 00:0D:87:8F:FD:38
ACCEPT all -- 192.168.0.247 anywhere MAC 00:0D:87:C4:85:E8
ACCEPT all -- 192.168.0.248 anywhere MAC 00:90:27:99:26:64
ACCEPT all -- 192.168.0.249 anywhere MAC 00:02:C5:08:BA:E7
ACCEPT all -- 192.168.0.250 anywhere MAC 00:A0:D1:E0:66:A7
ACCEPT all -- 192.168.0.251 anywhere MAC 00:10:5C:AC:D6:90
ACCEPT all -- 192.168.0.253 anywhere MAC 00:D0:B7:C6:8E:F3 ";
preg_match($pattern, $string, $match);
echo($match);
?>应该可以吧?
$pattern="/(\d+)\.(\d+)\.(\d+)\.(\d+)/";
$string="Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 192.168.14.0/24 anywhere
ACCEPT all -- 192.168.0.10 anywhere MAC 00:01:6C:F0:47:8A
ACCEPT all -- 192.168.0.246 anywhere MAC 00:0D:87:8F:FD:38
ACCEPT all -- 192.168.0.247 anywhere MAC 00:0D:87:C4:85:E8
ACCEPT all -- 192.168.0.248 anywhere MAC 00:90:27:99:26:64
ACCEPT all -- 192.168.0.249 anywhere MAC 00:02:C5:08:BA:E7
ACCEPT all -- 192.168.0.250 anywhere MAC 00:A0:D1:E0:66:A7
ACCEPT all -- 192.168.0.251 anywhere MAC 00:10:5C:AC:D6:90
ACCEPT all -- 192.168.0.253 anywhere MAC 00:D0:B7:C6:8E:F3 ";
$i=preg_match_all($pattern, $string, $match);
for ($j=0;$j<$i;$j++)
echo $match[0][$j]."<p>";?>