<apex:page controller="testController">
<apex:form id="myform">
<apex:pagemessages />
<apex:pageBlock id="myblock">
Email Address: <apex:inputText value="{!email}" id="email"/><br/><br/>
<apex:commandButton value="Click me!" action="{!checkEmail}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Code:
public class testController
{
public String email { get; set; }
public void checkEmail()
{
if(!Pattern.matches('[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-z
{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'Check your email'));
}
}
}
This comment has been removed by the author.
ReplyDeleteWhat would be the code to manage emails with the following format: example@yahoo.com.mx?
ReplyDeleteI really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! Verifications IO
ReplyDeleteThanks. Great solution. Much appreciated.
ReplyDelete