I want to show error message if user enter the email from few specific doamins. I tried this but didn't work out.
Email <input type="text" name="email" ng-model="txtmail" ng-pattern="/^[a-zA-Z0-9_.+-]+@(?:(?:[a-zA-Z0-9-]+\.)?[a-zA-Z]+\.)?(?!(domain|domain1|domain3))\.com$/" required />
[email protected] or [email protected] should not be allowed.



\.com$requires the string to end with.com, and it is certainly notomnitracs,xrscorp, norroadnet, you misused the lookahead here. You need custom logic here, use\.([^.]+)$and inspect the group value inside code.ng-patternregex.