I am having hard time finding out how can I get AngularJS not to ignore whitespaces in strings. Im trying to validate password requirements with AngularJS directive and regex pattern and problem is that I dont want to allow leading or trailing whitespace in password.
Here is fiddle http://jsfiddle.net/GX5Kr/9/
var regex = /^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]{5,})$/;
[SPACE][SPACE][SPACE][SPACE][SPACE]foo[SPACE][SPACE][SPACE][SPACE][SPACE]reports length3instead of13- are you sure it doesn'ttrimthe output?[a-zA-Z0-9]{5,}and its all wrapped with ^$ anchors. Must be something else.