$re = '/^(\s*)object\s(\w*):\sTcxRadioGroup.*?\n\1end/ms';
$str = 'object Form1: TForm1
Left = 0
Top = 0
Caption = \'Form1\'
ClientHeight = 494
ClientWidth = 635
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = \'Tahoma\'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object cxRadioGroup1: TcxRadioGroup
Left = 0
Top = 0
Align = alTop
Caption = \'cxRadioGroup1\'
Properties.Items = <>
TabOrder = 0
ExplicitLeft = 24
ExplicitTop = 16
ExplicitWidth = 185
Height = 105
Width = 635
end
object cxRadioGroup2: TcxRadioGroup
Left = 0
Top = 389
Align = alBottom
Properties.Items = <>
TabOrder = 1
ExplicitTop = 293
Height = 105
Width = 635
end
object Panel1: TPanel
Left = 200
Top = 111
Width = 257
Height = 265
Caption = \'Panel1\'
TabOrder = 2
object cxRadioGroup3: TcxRadioGroup
Left = 8
Top = 16
Caption = \'cxRadioGroup3\'
Properties.Items = <>
TabOrder = 0
Height = 105
Width = 185
end
object cxRadioGroup4: TcxRadioGroup
Left = 8
Top = 144
Properties.Items = <
item
Caption = \'item 1\'
end
item
Caption = \'item 2\'
end>
TabOrder = 1
Height = 105
Width = 185
end
end
end';
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