$re = '/(\w+\d+\/\d+)\s+(-?\d+\.\d+)(?=.+\1\s+(-\d+\.\d+))/ms';
$str = 'HE-EQM-01#show interfaces transceiver detail | begin Transmit Power
Transmit Power Threshold Threshold Threshold Threshold
Port (dBm) (dBm) (dBm) (dBm) (dBm)
--------- ----------------- ---------- --------- --------- ---------
Te1/2 -3.0 1.6 -1.3 -7.3 -11.3
Te1/3 -17.3 1.6 -1.3 -7.3 -11.3
Te1/4 -40.0 1.6 -1.3 -7.3 -11.3
Te2/2 -3.1 1.6 -1.3 -7.3 -11.3
Te2/3 -40.0 1.6 -1.3 -7.3 -11.3
Te2/4 -40.0 1.6 -1.3 -7.3 -11.3
Optical High Alarm High Warn Low Warn Low Alarm
Receive Power Threshold Threshold Threshold Threshold
Port (dBm) (dBm) (dBm) (dBm) (dBm)
------- ----------------- ---------- --------- --------- ---------
Te1/2 -40.0 1.9 -1.0 -9.9 -13.9
Te1/3 -2.6 1.9 -1.0 -9.9 -13.9
Te1/4 -2.9 1.9 -1.0 -9.9 -13.9
Te2/2 -3.0 1.9 -1.0 -9.9 -13.9
Te2/3 -2.6 1.9 -1.0 -9.9 -13.9';
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