I use ng-pattern to check my client side, if in several cases, for example, given the complexity of the password.
Now I get really strange matches in my regex using ng-pattern. See examples below.
<span class="registration-error" ng-show="regForm.password.$error.pattern">- Fail to match..</span> <input type="password" ng-model="registerForm.password" name="password" ng-pattern="/^.*(?=.{8,})(?=.*[az])(?=.*[AZ])(?=.*[\d\W]).*$/" required/>
The above should contain 8 characters, at least 1 uppercase character and 1 character or special character. For some reason, I get a match for words like FaiLoudD , which makes no sense.
I run the same regular expression in my python backend and works like a charm. I also checked the regex using http://regexpal.com/ and it also works great.
Why does ng-pattern match so weird?
Update:
I dug up all the modules and the entire build process of my application. The ng-pattern directive started working again when I disabled grunt-html2js in my build process. Ng-pattern seems to misinterpret the regular expression. Since the problem is being created in the html2js project. And with that I will close this question.
source share