regular expressions

TRegExpr Examples

uses RegExpr;
 
procedure TForm1.Button1Click(Sender: TObject);
// Validates the email address in Edit1
begin
  // Warning: this code should not be used to perform actual
  // email validation. You should check the RFC specification.
  // This is just a simplification to show the use of ExecRegExpr.
  if not ExecRegExpr('[\w\d\-\.]+@[\w\d\-]+(\.[\w\d\-]+)+',
      Edit1.Text) then begin
    ShowMessage('The email address is not valid');
    Edit1.SetFocus;
  end else
    ShowMessage('The email address is valid');
end;
 
procedure TForm1.Button2Click(Sender: TObject);

同步内容