Angular JS Email Validation with unicode characters

后端 未结 5 760
日久生厌
日久生厌 2021-01-05 08:45

I have a sign up form for an application, and angular js is responsible for its validation.

I ran into an issue when Angular js wasn\'t accepting an email address wh

5条回答
  •  天命终不由人
    2021-01-05 09:35

    Angular do not support the apostrophe(') in email Id. If you need to validate the apostrophe in Angular, you need to change the regular expression from:

    (/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)
    

    To:

    /^[A-Za-z0-9._%+'-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/.
    

    It will work perfectly.

提交回复
热议问题