$re = '/\s+TStatusBar/i';
$str = 'inherited FormPadrao: TFormPadrao
Left = 354
Top = 155
Caption = \'FormPadrao\'
ClientHeight = 342
ClientWidth = 655
KeyPreview = True
PopupMenu = MnPop_Principal
OnCloseQuery = FormCloseQuery
OnDeactivate = FormDeactivate
ExplicitWidth = 671
ExplicitHeight = 381
DesignSize = (
655
342)
PixelsPerInch = 96
TextHeight = 15
object Bv_Top: TBevel [0]
Left = 0
Top = 0
Width = 655
Height = 2
Align = alTop
end
object Sb_FormPadrao: TStatusBar [1]
Left = 0
Top = 317
Width = 655
Height = 25
Panels = <
item
Bevel = pbNone
Text = \'Usu\'#225\'rio\'
Width = 100
end
item
Bevel = pbNone
Width = 50
end>
ParentColor = True
ParentFont = True
UseSystemFont = False
ExplicitTop = 323
end
object Pn_BaseToolBar: TPanel [2]
Left = 0
Top = 2
Width = 655
Height = 73
Align = alTop
BevelOuter = bvNone
ParentColor = True
TabOrder = 2
end
object Pn_BaseGrid: TPanel [3]
Left = 0
Top = 75
Width = 655
Height = 242
Align = alClient
BevelOuter = bvNone
BorderWidth = 3
ParentColor = True
TabOrder = 4
ExplicitLeft = 32
ExplicitTop = 95
ExplicitHeight = 222
end
inherited MinMax: TmgMinMax
Top = 7
MinTrackSize.X = 450
MinTrackSize.Y = 300
ExplicitTop = 7
end
object Mn_Principal: TMainMenu [6]
Left = 4
Top = 36
object miTabela: TMenuItem
Caption = \'&Tabela\'
object miInserir: TMenuItem
Caption = \'&Inserir\'
end
object miApagar: TMenuItem
Caption = \'&Apagar\'
end
object miPropriedades: TMenuItem
Caption = \'&Editar\'
end
object N4: TMenuItem
Caption = \'-\'
end
object miFechar: TMenuItem
Caption = \'&Fechar\'
OnClick = miFecharClick
end
end
object miEditar1: TMenuItem
Caption = \'&Editar\'
object miRecortar1: TMenuItem
Caption = \'&Recortar\'
end
object miCopiar1: TMenuItem
Caption = \'&Copiar\'
end
object miColar1: TMenuItem
Caption = \'&Colar\'
end
end
object miExibir: TMenuItem
Caption = \'&Exibir\'
object miBarradeFerramentas: TMenuItem
Caption = \'Barra de &Ferramentas\'
object miNaoExibir: TMenuItem
Caption = \'&N\'#227\'o Exibir\'
GroupIndex = 1
RadioItem = True
OnClick = mi_NaoExibirClick
end
object N5: TMenuItem
Caption = \'-\'
GroupIndex = 1
RadioItem = True
end
object miAlto: TMenuItem
Caption = \'&Alto\'
GroupIndex = 1
RadioItem = True
OnClick = mi_AltoClick
end
object miBaixo: TMenuItem
Caption = \'&Baixo\'
GroupIndex = 1
RadioItem = True
OnClick = mi_BaixoClick
end
end
object miBarradeStatus: TMenuItem
Caption = \'Barra de &Status\'
OnClick = mi_BarradeStatusClick
end
object mi_SepN3: TMenuItem
Caption = \'-\'
end
object mi_Informacoesdajanela1: TMenuItem
Caption = \'Informa\'#231#245\'es desta Janela\'
OnClick = mi_Informacoesdajanela1Click
end
object mi_Sepm9: TMenuItem
Caption = \'-\'
Visible = False
end
object mi_OcorrenciaAuditoria: TMenuItem
Caption = \'Logs de Auditoria\'
Visible = False
OnClick = mi_OcorrenciaAuditoriaClick
end
end
object Mi_Ajuda: TMenuItem
Caption = \'&Ajuda\'
object Mi_AjudaProcesso: TMenuItem
Caption = \'Ajuda &Processo\'
ShortCut = 112
OnClick = Mi_AjudaProcessoClick
end
object Mi_AjudaTela: TMenuItem
Caption = \'Ajuda &Tela\'
ShortCut = 16496
OnClick = Mi_AjudaTelaClick
end
object Mi_HistoricoAlteracoes: TMenuItem
Caption = \'&Hist\'#243\'rico de altera\'#231#245\'es\'
Visible = False
OnClick = Mi_HistoricoAlteracoesClick
end
end
end
inherited mgPopupImpressao: TmgPopupMenu
Left = 4
end
object MnPop_Principal: TPopupMenu
Left = 34
Top = 36
object mi_Inserir: TMenuItem
Caption = \'&Inserir\'
end
object mi_Apagar: TMenuItem
Caption = \'&Apagar\'
end
object mi_Editar: TMenuItem
Caption = \'&Editar\'
end
object N1: TMenuItem
Caption = \'-\'
end
object mi_BarradeFerramentas: TMenuItem
Caption = \'&Barra de Ferramentas\'
object mi_NaoExibir: TMenuItem
Caption = \'&N\'#227\'o Exibir\'
GroupIndex = 1
RadioItem = True
OnClick = mi_NaoExibirClick
end
object N2: TMenuItem
Caption = \'-\'
GroupIndex = 1
RadioItem = True
end
object mi_Alto: TMenuItem
Caption = \'&Alto\'
GroupIndex = 1
RadioItem = True
OnClick = mi_AltoClick
end
object mi_Baixo: TMenuItem
Caption = \'&Baixo\'
GroupIndex = 1
RadioItem = True
OnClick = mi_BaixoClick
end
end
object mi_BarradeStatus: TMenuItem
Caption = \'Ba&rra de Status\'
OnClick = mi_BarradeStatusClick
end
end
end';
$subst = " TMgStatusBar";
$result = preg_replace($re, $subst, $str, 1);
echo "The result of the substitution is ".$result;
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