$re = '/((?:[0-9a-f]{2}[:-]){5}[0-9a-f]{2})\s+?((?:[0-9a-f]{2}[:-]){5}[0-9a-f]{2}|N A)\s+(AP.+?|N A)\s/m';
$str = '00:0b:85:57:bc:c0 00:0b:85:57:bc:c1 AP1130 10.10.163.217 Joined
00:1c:0f:81:db:80 00:1c:63:23:ac:a0 AP1140 10.10.163.216 Joined
00:1c:0f:81:fc:20 00:1b:d5:9f:7d:b2 AP1 10.10.163.215 Joined
00:1c:0f:81:fc:20 N A N A 10.10.163.215 Not joined
00:21:1b:ea:36:60 00:0c:d4:8a:6b:c1 AP2 10.10.163.214 Joined';
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