email validation

Hi,

I would like to return an error if the user inputs some text instead of email.

I have the below regex and textField.  Can someone guide me how to link these two to perform the required validation.

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

a!textField(

label: "Email",

value: ri!employee.email,

saveInto: {ri!employee.email},

inputPurpose: "EMAIL"

)

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Additionally the People Functions plug-in has a built-in function now, "validateEmailAddress()", which works at least as well as the Regex version you posted here originally (which looks like the one i've posted in the past elsewhere).

    Both People Functions and the RegEx plugin should be considered standard and non-controversial, so I'm unclear why you would want to / be required to avoid using them. Can you provide any more info on this?

    If push comes to shove, the old thread I linked above contains my "classic" OOB rule that does a pretty good job at validating an email address, but I personally recommend just using the RegEx or People Functions versions now, unless in an emergency.