RegularExpressionValidator for multiple emails

前端 未结 3 512
心在旅途
心在旅途 2021-01-07 01:42

I\'m validating a textbox for valid email with this:



        
相关标签:
3条回答
  • 2021-01-07 01:59

    I should do this: what it does is check for at least one mail, and for list of email before it with each a comma and possibly a space.

    ^(([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?), ?)*^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$
    

    Use this if the space between each mail is required:

    ^(([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?), )*^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$
    

    Note I just used your single mail checker as a base and didn't really edit it.

    0 讨论(0)
  • 2021-01-07 02:07

    try this expression:

    ^(\s*,?\s*[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})+\s*$
    
    0 讨论(0)
  • 2021-01-07 02:22

    Try the expression below, which works for me:

    ((\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*([,])*)*
    

    The above code is for ,, separating e-mail addresses.

    If you would like to use ; instead of ,, than replace , with ; at the end of the above expression.

    0 讨论(0)
提交回复
热议问题