If Not Statement with @ Sign

Hello. I want to have a space for users to enter their email address. I want to make it so that you have to enter an @ sign. What would the validation look like for this? Thanks

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Thank you, Mike, that's very nice of you, I will consider it

  • 0
    Certified Lead Developer
    in reply to benjamins0003

    In case you or anyone else wants my code for this, here is the current version:

    /*  Email Address Validation for Appian  */
      /*  Allows the 'name' to contain letters, numbers, plus period and special characters: _ - + ' & %  */
      /*  Allows the 'domain' to contain only letters, numbers, period and dash.  */
    
    if(
      or(
        isnull(trim(ri!address)),
        len(trim(ri!address)) > 255,
        length(split(trim(ri!address), " ")) > 1,
        count(split(ri!address, "@")) <> 2
      ),
      false(),
      
      with(
        local!userPart: split(trim(ri!address),"@")[1],
        local!domainPart: split(trim(ri!address),"@")[2],
        
        if(
          or(
            length(split(local!domainPart, ".")) < 2,
            contains(split(local!userPart, "."), ""),
            contains(split(local!domainPart, "."), ""),
            not(isnull(stripwith(lower(local!domainPart), "abcdefghijklmnopqrstuvwxyz1234567890-."))),
            not(isnull(stripwith(lower(local!userPart), "abcdefghijklmnopqrstuvwxyz1234567890-._+'&%")))
          ),
            
          false(),
          true()
        )
      )
    )

    Saved as an Expression Rule, this code simply returns True or False, referring to whether a given email address is valid.