$re = '/.+left X:..(.+?)\n.+Y:..(.+?)\n.+\n.+\n.+:.(.+?)\n.+:.(.+?)\n/';
$str = '
xwininfo: Window id: 0x4800024 "Yebe"
Absolute upper-left X: 100
Absolute upper-left Y: 164
Relative upper-left X: 10
Relative upper-left Y: 45
Width: 1600
Height: 1200
Depth: 24
Visual: 0x6e
Visual Class: DirectColor
Border width: 0
Class: InputOutput
Colormap: 0x4800022 (not installed)
Bit Gravity State: ForgetGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +100+164 -860+164 -860-76 +100-76
-geometry 1600x1200+90-66';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 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