Skip to main content
December 28, 2023
Question

Multiple email address validation check

  • December 28, 2023
  • 13 replies
  • 0 views

I need to validate if the list is line delimited and in a valid email format using regex in paragraph field .  If not , throw a validation message.


test@test.com

test2@test.com

test3@test.com

    13 replies

    davidj137213
    Brainy
    December 28, 2023

    OK, and what is the question? For using regular expressions, you can use the plugin Regular Expression Functions from App MArkt.... 

    mikes0011
    Brainy
    December 28, 2023

    For validating an email address you can certainly contrive a complex regular expression to test for validity, though these days I just recommend using the "validateEmailAddress()" rule found in, i think, People Functions.

    As far as "line delimited" - you'll need to implement your own parsing / checking for that part, depending on exactly what you want.  It could be as simple as splitting the input on the linebreak character (char(10)) then validating each (non-empty) line in the resulting set - that would simply require looping over the validate email function.

    mathieud0001
    January 3, 2024

    I try to use the built-in Appian function for this as well. If that is not enough, I'll look at a regex solution.

    mikes0011
    Brainy
    January 3, 2024

    I have an expression rule where I added ~18 extended test cases - edge cases to try to break the validation function - a while ago I developed a RegEx that handles all of them, and the plug-in rule (which came later iirc) handles all of them as well.  I switch back and forth regarding which version to use - i haven't noticed any major performance difference between them (and they both use a plug-in ultimately so it's not like either version saves a dependency).

    January 2, 2024

    You can try this:

     

    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
                        )


    sabat0002Author
    January 5, 2024

    Hi [mention:391c81fddc8d46d3a321249e5a3d9057:e9ed411860ed4f2ba0265705b8793d05]  , if i use the above code then if space is present at beginning or at the end ..it is throwing error .

    can you please help me with this

    January 5, 2024

    Hi Fursat,

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

    The above regular expression will allow you to add white space at start and end.

    Try this and let me know if it works for you.

    stefanhelzle0001
    Brainy
    January 2, 2024

    Depending on your actual use case, this might be a good fit.

    https://appian.rocks/2023/12/04/the-master-of-email-address-fields/

    sabat0002Author
    January 3, 2024

    in that code,  if we enter incorrect email address format it is not throwing any validation error,it is saving only correct email address for incorrect ones nothing is displayed as error

    mikes0011
    Brainy
    January 3, 2024
    it is not throwing any validation error

    you'll need to share what you've tried if you hope to find additional help with getting a validation message to show up.  this is not much info to go on.