Jump to content

Recommended Posts

Posted

Hi

 

For creating a username in my application i use the customer e-mail address.

 

Is there a example how to check if the entered e-mail address has a valid syntax with @ and .

 

Regards Peter

Posted

I use this function:

 

function ValidarEMail(vStr: string): Boolean;
begin
  vStr := Trim(UpperCase(vStr));
  if Pos('@', vStr) > 1 then
    begin
      Delete(vStr, 1, pos('@', vStr));
      Result := (Length(vStr) > 0) and (Pos('.', vStr) > 2);
    end
  else
    Result := False;
end;
Posted
I use the extended events.

You choose!

 

ClientEvents -> UniEvents

 

function beforeInit(sender, config)

{

  Ext.apply(sender,{

   allowBlank:false,

   vtype:'email',

   msgTarget : 'side'

   }

  );

}
Posted

I use TRegEx

 
var
FoundMatch: Boolean;
 
FoundMatch := False;
try
     FoundMatch := TRegEx.IsMatch(S, '\A\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}\b\z', [roIgnoreCase]);
except
     on E: ERegularExpressionError do
     begin
            // Syntax error in the regular expression
     end;
end;
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...