validateemailaddress() ?

Certified Associate Developer

What all cases are covered while using validateemailaddress() ?

  Discussion posts and replies are publicly visible

Parents
  • for validating email address you can use this regex 

    regexmatch("^[\w\.\-]+@[\w\.\-]+\.[\w\.]{2,}$",ri!input)

  • 0
    Certified Lead Developer
    in reply to peanut

    This pattern fails a bunch of the test cases I have set up in my Validate Email Addresses expression rule.  Two of the most obvious/important failure cases is that it doesn't return "false" for email addresses beginning or ending with extraneous periods (".").

    This is the pattern I use in mine, which passes a rather rigorous 18 test cases (though i can't guarantee it passes all realistic ones, just the ones i've been able to think of).

    regexmatch(
      pattern: "^[A-Z0-9\'\+\&\%_-]+(\.{0,1}[A-Z0-9\'\+\&\%_-]+)*[@]{1}[A-Z0-9.-]*[A-Z0-9-]+[.]{1}[A-Z]{2,6}$",
      searchString: ri!email,
      regexFlags: "si"
    )

    Also note: all of the above test cases also correctly pass using the "validateEmailAddress()" function from People Functions, for what it's worth.

Reply
  • 0
    Certified Lead Developer
    in reply to peanut

    This pattern fails a bunch of the test cases I have set up in my Validate Email Addresses expression rule.  Two of the most obvious/important failure cases is that it doesn't return "false" for email addresses beginning or ending with extraneous periods (".").

    This is the pattern I use in mine, which passes a rather rigorous 18 test cases (though i can't guarantee it passes all realistic ones, just the ones i've been able to think of).

    regexmatch(
      pattern: "^[A-Z0-9\'\+\&\%_-]+(\.{0,1}[A-Z0-9\'\+\&\%_-]+)*[@]{1}[A-Z0-9.-]*[A-Z0-9-]+[.]{1}[A-Z]{2,6}$",
      searchString: ri!email,
      regexFlags: "si"
    )

    Also note: all of the above test cases also correctly pass using the "validateEmailAddress()" function from People Functions, for what it's worth.

Children