Email field validation

Please let me know the email field validation
Regards,
Pallavi

I made an awesomely good email verification string:
'^[[:alnum:]][[:alnum:]_\-\.]*@([[:alnum:]]([[:alnum:]\-]*[[:alnum:]])?\.)+[[:alpha:]]+$'Try to break it for me :)
-UPDATE 1-
'^[[:alnum:]]([[:alnum:]_\-\.]*[[:alnum:]])?@([[:alnum:]]([[:alnum:]\-]*[[:alnum:]])?\.)+[[:alpha:]]+$'Forgot the last character of the local part has to be alnum :)
Argh, hyphens still break it in the local part.
-UPDATE 2-
'^[[:alnum:]]([-[:alnum:]_\.]*[[:alnum:]])?@([[:alnum:]]([-[:alnum:]]*[[:alnum:]])?\.)+[[:alpha:]]+$'Hah, apparently hyphens can't be escaped from...
You have to put them at the start or end of the list.

Similar Messages

  • Email field validation function

    HI,
    I came across this regular expression which i am using for email validation :
    var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/iCould you please explain the reg expression.Also how can i include
    "-" (hyphen) and underscore to this reg expression?
    Thanks a lot!
    Vivek
    Message was edited by:
    vivek.shankar

    Why not use the jakarta EmailValidator?
    org.apache.commons.validator.EmailValidator
    then you can say things like
    public boolean vaildEmailAddress(String sEmail){
         EmailValidator emailValidator = EmailValidator.getInstance();
         return emailValidator.isValid(sEmail);
    )

  • Validating Emails fields in my Dialog Box

    Hi all, I want to validate emails in my dialog box. My field are automatically fill by an XML and I want to validate them. I am able to validate them when the user enter a new email but if the user do not enter a new email and hit "OK", there is no validation. Any idea? Thanks!
    var submitEmailTo = "[email protected]\rclient@somewherecom"
    var submitEmailFrom = "[email protected]"
    var patt = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/g;
    var dialog1 = {
        submitEmailTo: "",
        submitEmailFrom: "",
        submitEmailMessage: "",
        initialize: function (dialog)
            dialog.load(
                "emto": submitEmailTo
            dialog.load(
                "emfr": submitEmailFrom
        commit: function (dialog)
            var results = dialog.store();
            this.submitEmailTo = results["emto"];
            this.submitEmailFrom = results["emfr"];
            this.submitEmailMessage = results["mess"];
        emto: function (dialog)
        var data = dialog.store(["emto"])
        emtoString = data["emto"]
        emtoArray = emtoString.split("\r")
        for (var i=0;i<emtoArray.length;i++)
            if (emtoArray[i].match(patt) == null)
                    app.alert("Le courriel \"" + emtoArray[i] + "\"ne semble pas valide.", 1, 0, "Validating");
        description:
            name: "Job Information", // Dialog box title
            align_children: "align_row",
            width: 400,
            height: 200,
            elements: [
                type: "cluster",
                name: "Email Information",
                align_children: "align_right",
                elements: [
                    type: "view",
                    align_children: "align_row",
                    elements: [
                        type: "static_text",
                        name: "From (CVSC): "
                        item_id: "emfr",
                        type: "edit_text",
                        alignment: "align_left",
                        width: 400,
                        height: 20
                    type: "view",
                    align_children: "align_row",
                    elements: [
                        type: "static_text",
                        name: "To: "
                        item_id: "emto",
                        type: "edit_text",
                        multiline: true,
                        alignment: "align_left",
                        width: 400,
                        height: 30
                    type: "view",
                    align_children: "align_row",
                    elements: [
                        type: "static_text",
                        name: "mess: "
                        item_id: "emto",
                        type: "edit_text",
                        multiline: true,
                        alignment: "align_left",
                        width: 400,
                        height: 70
                    alignment: "align_right",
                    type: "ok_cancel",
                    ok_name: "Ok",
                    cancel_name: "Cancel"
    app.execDialog(dialog1)
    this.info.submitEmailTo = dialog1.submitEmailTo
    this.info.submitEmailCC = dialog1.submitEmailCC
    this.info.submitEmailMessage = dialog1.submitEmailMessage

    Actually this code is  attached to a button action. When my form is opened at first, my fields are populated and all the extra information are send to custom metadata.
    The opearator here, will hit a button  and a big dialog box appear with all the job information. You see actually only the email cluster. The idea is to help the operator to  easily build an email with copy and paste. Sometime the emails fields will be filled automatically and sometime the operator will fill them.
    The reason I go through a dialog box is I don't want the client to see to much information and the email is sent by a another application.
    My first idea was to put a validation script on the "OK" button but it seems not possible to "cancel" this action.

  • Validating Email Field

    Hi
    I am developing a form in which there is an email field which i have to enter in a textArea.
    tell me how can i check whether the entered email id is valid or not.
    Its urgent
    Thanks in advance
    Dhiraj

    In case you are using JDK version prior to 1.4 you can use following function.
    <pre>
    * Validates the structure of the Email Address. This method covers most
    * requirements of the RFC822 specification.
    * @param strEmailAddress Email Address to be validated
    * @return true if validation is successful, false otherwise
    * @see RFC822
    * @see * Online Email Validator
    public static boolean isValidEmailAddress(String strEmailAddress)
              boolean bValid = true;
              // return false if strEmailAddress is either null or empty
              if (isNullorEmpty(strEmailAddress)) {
                   return false;
              // calculate length of the email address
              int iLength = strEmailAddress.length();
              // get the first occurrence of @ char
              int iCharAtPosition = strEmailAddress.indexOf("@");
              // validation fails if @ character is not present
    if (iCharAtPosition == -1) {
         bValid = false;
              // validation fails if @ character found is in the first or last position
    else if ((iCharAtPosition == 0) || (iCharAtPosition == (iLength - 1))) {
         bValid = false;
              // validation fails if more than 1 @ character are present
    else if (strEmailAddress.indexOf("@", iCharAtPosition + 1) > -1) {
    bValid = false;
              else {
                   // traverse thru all the characters in the given email address
         for (int i = 0; i < iLength; i++) {
              // get the character at the i position
         char c = strEmailAddress.charAt(i);
         if (c == '.') {
                             // validation fails if . character found is in the first or last position
              if ((i == 0) || (i == (iLength - 1))) {
              bValid = false;
              break;
         // . character cannot come before @ character
         else if (i == (iCharAtPosition-1)) {
              bValid = false;
              break;
         // all these are invalid characters
         else if ( c > '~' || c < '!' || c == '(' || c == ')' ||
         c == '<' || c == '>' || c == '[' || c == ']' ||
         c == ',' || c == ';' || c == ':' || c == '\\' ||
         c == '"') {
                             bValid = false;
         break;
              // return the validation flag          
    return bValid;
    </pre>

  • Update address-dependent email field on save of BP

    We have a requirement to update the address-dependent email field from the address-independent email field upon saving a Business Partner.
    I've been working on the 'BUPA_ADDR_UPDATE' BADi but am having no luck with it so far. I have managed to retrieve the data in the address-independent email field using the 'BUPA_CENTRAL_GET_DETAIL' Function Module but as yet have not been able to do the update of the address-dependent email field.
    Can anyone offer any guidance please ?
    thanks,
    Malcolm.

    Hi Malcolm,
    Try using the BADI : ADDR_UPDATE.
    Email is a part of the address management, so you would need an address badi.
    BUPA_ADDR_UPDATE is a business partner badi and only has the address reference - such as address number, validity, move date, etc..it will not help in cases where you need to work with address fields such as city, country, email,etc.
    Another approach :
    Try writing your code in PARTNER_UPDATE badi. This is called after save of BP. So you can probably trigger another update on the BP's address from here..
    Hope this helps you.
    Cheers,
    Rishu.

  • How to Validate Email field & Other..

    Hi,
    1. I have a requirement in which I have to check that the texinput field i.e EMail field should have @ in it. If not then I need to throw exception.
    Can anybody tell me how to check @ from VO attribute.
    2. There is another text input field in which I have to check that the input value by user should not be less than 0 and greater than 15. -- Not solved Yet
    I will do these validation on submit button.
    Please help.
    Thanks in advance.
    Ajay
    Edited by: Ajay Sharma on Apr 29, 2009 6:07 AM
    Edited by: Ajay Sharma on Apr 29, 2009 8:28 PM
    Edited by: Ajay Sharma on Apr 29, 2009 8:29 PM

    Hi,
    I am trying with this...
    public boolean validateFormat(String Item)
    boolean isAlphanumeric = false;
    Number number = null;
    if(Item != null && !"".equals(Item))
    try
    number = new Number(Item);
    catch(SQLException sqlexception)
    {System.out.println("Error in conversion"); }
    if(( number < 0) && (number > 11))
    isAlphanumeric = true;
    return isAlphanumeric;
    But I am getting error while compiling
    Error(332,21): method <(oracle.jbo.domain.Number, int) not found in class exl.oracle.apps.per.eexit.server.EmployeeAMImpl
    Error(332,37): method >(oracle.jbo.domain.Number, int) not found in class exl.oracle.apps.per.eexit.server.EmployeeAMImpl
    Thanks
    Ajay

  • Field validation regular expression to accept only numbers

    Hello.
    I would like to have a field validation regular expression to accept only numbers - no characters. The list of pre-packaged regular expressions that are included with ApEx does not contain this and I am not a very good regular expression writer. Can anyone help?
    Thanks!
    Boris

    Under the Regular Expression validation all you need to have is:
    ^[[:digit:]]$For the email address it just depends how detailed you want it:
    ^((?>[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+)+|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)>)$or...
    [\w-]+@([\w-]+\.)+[\w-]+Hope these help
    Edited by: MikesHotRod on Sep 3, 2008 12:40 PM

  • Email address validation

    Hi,
    We recently deployed a basic questionnaire being used by military personnel.  We turned on the "Submission Receipts" option so that respondents could receive a copy of their submission.  We have discovered that due to the elaborate format of some military email addresses (First.Middle.Last.role(civ, ctr, mil)@whatever.mil), the system was not allowing the results to be recorded because it deemed the email address invalid.  Can someone verify whether or not this is indeed an issue in the FormsCentral processing?
    Thanks!

    Previously, we had the "Submissions  Receipts" option turned on and used an email address field.  We got reports that people with .mil email addresses were getting errors that the email address was invalid and subsequently the data did not seem to be captured.  So, we turned off the option and changed the "Email" field to a text field so that it didn't perform the validation check.  Since that field is now optional, it isn't a big issue but might be of some use in the future.
    This morning I went to share access to the form to an employee who works for a company with a .us email address.  When I typed in her email address, the interface said it was an invalid email address.  I just tried again and this time it worked fine so if you fixed it, thanks for the quick turnaround.
    If you require more detailed information or a link to the form, please email me directly.  Thanks!

  • Email address validation pattern

    First off, I'm using JDK 1.4.2_07. What I'm trying to do is validate email addresses with the String.matches(String pattern) function. What I'm having a problem with is coming up with the regex pattern that represents any syntactically valid email address. If someone has a regex pattern that does represent any syntactically valid email address, I would appreciate it if you posted it in a reply to this message. Thanks!
    --Ioeth                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Here is the struts implementation of email address validation:
    <validator name="email"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateEmail"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.email">
    <javascript><![CDATA[
    function validateEmail(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oEmail = new email();
    for (x in oEmail) {
    if ((form[oEmail[x][0]].type == 'text' ||
    form[oEmail[x][0]].type == 'textarea') &&
    (form[oEmail[x][0]].value.length > 0)) {
    if (!checkEmail(form[oEmail[x][0]].value)) {
    if (i == 0) {
    focusField = form[oEmail[x][0]];
    fields[i++] = oEmail[x][1];
    bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    * Reference: Sandeep V. Tamhankar ([email protected]),
    * http://javascript.internet.com
    function checkEmail(emailStr) {
    if (emailStr.length == 0) {
    return true;
    var emailPat=/^(.+)@(.+)$/;
    var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
    var validChars="\[^\\s" + specialChars + "\]";
    var quotedUser="(\"[^\"]*\")";
    var ipDomainPat=/^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})$/;
    var atom=validChars + '+';
    var word="(" + atom + "|" + quotedUser + ")";
    var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
    var domainPat=new RegExp("^" + atom + "(\\." + atom + ")*$");
    var matchArray=emailStr.match(emailPat);
    if (matchArray == null) {
    return false;
    var user=matchArray[1];
    var domain=matchArray[2];
    if (user.match(userPat) == null) {
    return false;
    var IPArray = domain.match(ipDomainPat);
    if (IPArray != null) {
    for (var i = 1; i <= 4; i++) {
    if (IPArray[i] > 255) {
    return false;
    return true;
    var domainArray=domain.match(domainPat);
    if (domainArray == null) {
    return false;
    var atomPat=new RegExp(atom,"g");
    var domArr=domain.match(atomPat);
    var len=domArr.length;
    if ((domArr[domArr.length-1].length < 2) ||
    (domArr[domArr.length-1].length > 3)) {
    return false;
    if (len < 2) {
    return false;
    return true;
    }]]>
    </javascript>
    </validator>

  • Email form validation

    Having trouble with an email form validation. I have an email
    field that is optional. Therefore, if the user leaves it blank, the
    form should submit. However, I also want to check that if the user
    did fill out the email address, it is valid. I am checking that if
    it does not contain and '@', a '.' or does contain a ',' to give an
    error. Whenever I submit a blank form, it keeps giving error that
    the email address is not valid. Here is my code:
    <cfif (Len(Trim(form.email)) IS 0)>
    <cfif form.email does not contain "@" or form.email does
    not contain "." or form.email contains ",">
    <script language="JavaScript">
    alert("Your email address is not valid. Please correct it
    and resubmit the form.")
    history.back()
    </script>
    <cfabort>
    </cfif>
    </cfif>
    Please assist. Thanks, Lumpia.

    duplicate post

  • Trying to create a Field Validation Expression and need help

    I have a picklist field and another field that are in question. I want to set some sort of rule that forces the second field to be populated only If specific values are selected from the picklist field.
    I was going the route of a field validation Rule, but everything i've tried so far does not produce the results i am trying to achieve.
    The first type of expression i tried was:
    ([<plProduction_Print_Account_Category_ITAG>] <> LookupValue("OCC_CUST_LOV_ACCOUNT_1", "No Production Print") AND ([<stSIC_Code_ITAG>] IS NULL))
    This is generating the field validation error message when i select any of the correct values from the picklist. the problem is still the second field, which will generate the error if a value is entered into the second field, regardless of the picklist value selected. Switching the "IS NULL" to "IS NOT NULL" only reverses the problem on the second field, causing the error to generate when the second field is updated to a NULL or blank value.
    I also tried :
    = 'No Production Print' AND [<stSIC_Code_ITAG>] IS NOT NULL
    and got similar results.
    ([<plProduction_Print_Account_Category_ITAG>] = LookupValue("OCC_CUST_LOV_ACCOUNT_1", "No Production Print"))
    Similar results as well.
    Does this need to be an IIF statement? Do I need to make this a workflow expression instead? i could really use some help as I have tried everything i can think of and admit, i'm not the expression guru!!!. Any assistance would be appreciated.
    TeknoMan

    Yes we have the same request and we used the following expression. Example we have a field "Método de pago" ( [<plMtodo_de_pago_ITAG<]), it's values are "CHEQUE and DEPOSITO" if we select DEPOSITO three more fields were requiered Route, Sucursal de banco and Clabe so we have to put this validation in the four fields including Metodo de pago.
    [<plMtodo_de_pago_ITAG>] <> "DEPOSITO" OR ([<Route>] IS NOT NULL AND [<nSucursal_de_banco_ITAG>] IS NOT NULL AND [<stCLABE_ITAG>] IS NOT NULL)
    well in the field CLABE we put the following [<plMtodo_de_pago_ITAG>] <> "DEPOSITO" OR ([<Route>] IS NOT NULL AND [<nSucursal_de_banco_ITAG>] IS NOT NULL AND [<stCLABE_ITAG>] IS NOT NULL AND Len([<stCLABE_ITAG>])=18) this was because the len of the value must be 18 characters.
    I hope this works for you
    Regards Catalina Valadez
    Edited by: CatalinaV on 12/03/2009 10:54 AM
    Edited by: CatalinaV on 12/03/2009 10:55 AM

  • How can I do field validation on the last two characters of a text field?

    I have a text field. The user is required to enter the last two characters as numbers. I want to apply validation on this field. How can i achieve the same?
    EX: If the user enter ABCDE, an error messgae stating the last two digit should be numeric.
    I tried using the below in the field validation which did not work.
    (0+Right([<ExternalSystemId>],2)) > 0 AND (0+Right([<ExternalSystemId>],2)) < 99.
    Any ideas would help?

    Try this-
    FindOneOf(Right([<Field1>],"2"),"abcdefghijklmnopqrstuvwxyz")=0
    rgds,
    Amit

  • Mandatory field validation on Page links.

    We have created a Portal application where we included different applications as taskflows. We have also created a tabbed interface which helps us to communicate from one task flow to another taskflow. When we are in one page of taskflow and try to move to another page of different taskflow using tabbed interface we receive mandatory field validation error which prevents us to move to any other page until we fill all the mandatory fields. We need to move to different page of taskflow by using the tabbed interface even without filling all the necessary mandatory fields. Can anyone help us to resolve this issue as this is very important for our project.

    <b>Layout</b>
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2003" >
      <htmlb:page title="Check Pernr " >
        <htmlb:form>
          <htmlb:textView text   = "Personnel No."
                          design = "EMPHASIZED" />
          <htmlb:inputField id    = "pernr"
                            value = "<%= lv_pernr %>" />
    <%
    if lv_no_pernr = 'X'.
    %>
    <script language="Javascript">
    alert ("Personnel no. is not Valid")
    </script>
    <%endif.%>
       </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    <b>ONINPUTPROCESSING</b>
    DATA: l_pernr TYPE persno.
      DATA: data TYPE REF TO cl_htmlb_inputfield.
      data ?= cl_htmlb_manager=>get_data( request = runtime->server->request
                                             name     = 'inputField'
                                             id       = 'pernr' ).
      IF data IS NOT INITIAL.
        l_pernr = data->value.
      ENDIF.
    CLEAR lv_no_pernr.
    SELECT SINGLE pernr FROM pa0000 INTO l_pernr WHERE pernr EQ lv_pernr.
    IF sy-subrc NE 0.
      lv_no_pernr = 'X'.
    ENDIF.
    <b>PAGE ATTRIBUTES</b>
    lv_no_pernr     TYPE     FLAG
    lv_pernr     TYPE     PERSNO
    hope this helps.
    A

  • Field Validation on Read Only Field

    I'm trying to create a pop up error box if a field contains null values. The problem is that the field I'm trying to do the validation on is a read-only field. It's the Account field on the Contact Object or Module. It won't allow me to include validation. The goal here is to have a POP UP ERROR box come up if someone does not select a value for that field. Making it required doesn't generate a popup box, it only has a small "required" text next to the field which can be easily missed by a user. Any ideas?

    Hi !
    I found the way to do what you wan't, but it sounds a bit strange for me...
    You have to put a field validation on the Account Id field. I made some tests to know what is in the AccountId field when it's blank and i see that the value is "No Match Row Id" !!
    So your validation rule must be simply
    *&lt;&gt; "No Match Row Id"*
    It worked for me, the error message appears... But I think this is something we have to report to Oracle...
    Hope this will help, feel free to ask more !
    Max

  • How to pass smtp_addr(email field) to cremas idoc while creation of vendor?

    Hi All,
    i am creating the vendors by IDOC by using CREMAS basic type CREMAS05.
    There is no email field in any of the idoc segments,as i need to pass the email address being mandatory,
    i created the Z segment and added the email field into it and then created the z extension and added this zsegment into the extension.
    Now how do i and where do i map this field so that email data is also passed while creating the vendor master.
    i have debugged the cremas Function Module IDOC_INPUT_CREDITOR and the data is getting passed segment wise,and for customer segement i.e for the zsegment there is a enhancement section where i need to pass this field,but i do not know how do i map this field and with what structure.
    Please let me know how do i handel this/or is there in other way to do it.
    Thanks.
    RJP.

    Hi,
    the email is part of the address data. It is therefore not belonging to the customer master data. So it is also not part of the DEBMAS idoctype.
    To distribute via ALE accurate customer address data, you need to distribute ADRMAS, ADR2MAS, ADR3MAS idoctypes too.
    See [note 384462|https://service.sap.com/sap/support/notes/384462] and [note 306275|https://service.sap.com/sap/support/notes/306275]
    BR
    Alain

Maybe you are looking for

  • How do you generate log files using ActionScript 3?

    Is there any way to log activity using AS3 by using a Red5 Media Server? I cam across www.as3commons.org/as3-commons-logging but in this I have no clue how to access logfiles or where the logfiles are generated. I was wondering if there's a way to ge

  • Need help on Webi

    I am creating a webi report where each person has own complaint numbers. The result I wanted to be: Person A Person B Person C 1 4 7 3 5 9 2 8 6 I tried several ways but nothing come out correctly.  One of them is I just put complaint number and all

  • Why does Firefox not include FOX NEWS in their pre-loaded "News" tab on the toolbar???

    There are 9 different "news" sources. It seems that everybody is so biased against Fox News, yet they produce legitimate news as every other network. Please change this, Firefox, for all your users.

  • Photoshop elements 12 connection problem

    Editor workspace would not load. After trying system restore the problem was still there. I reinstalled the product from disc, but on trying to reactivate I got an error message Please conect to the internet and retry, either your computer is offline

  • Linking two standard Fiori apps

    Hello Experts, I have one query in Fiori standard app and need your inputs on this. We need to provide a link between two standard transactional apps, so that when we click on the link from the first app it should navigate us to second app. Please su