Way to Validate Email Addresses

Hello Everyone:
I was wondering if anyone has developed a way to validate email addresses?

OriginalPostID-204914

OriginalPostID-204914

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Since this zombie thread has already been dredged back up anyway....

    A while ago I switched to a regex-based validation solution because despite the best updates to the OOB approach posted below originally, there were still corner cases that were hard to handle sufficiently without the inherent power of RegEx matching.

    The RegEx originally posted by Shailendras almost 6 years ago fails in some valid and common corner cases, including name or domain parts with multiple pieces separated by ".", such as "mike@mail.appian.com" etc.

    Eventually I was able to work up the following RegEx match function by a combination of a few different sources and my own testing, which passes a fairly robust set of test cases, screenshotted below:

    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"
    )

    The above code simply replaced my old, OOTB code in the expression rule I'd been using (i actually kept it, but commented out, for posterity).

    I should also note that the modern version of the People Functions plug-in seems to have a built-in expression funciton, validateEmailAddress(), which I can confirm passes all of the above test cases as well.