Why is Angularjs ng-pattern not working with the following regexp?

前端 未结 3 1823
独厮守ぢ
独厮守ぢ 2020-12-16 14:17

For some reason the initialized value doesn\'t appear in the field, but the second field without the ng-pattern does work. any ideas?

    angular.module(\'ap         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 15:14

    Yes indeed! This was causing me an issue to...leaving the quotes out is what fixed it for me.

     $scope.regVal= /([A-Z]{3}\s?(\d{3}|\d{2}|d{1})\s?[A-Z])|([A-Z]\s?(\d{3}|\d{2}|\d{1})\s?[A-Z]{3})|(([A-HK-PRSVWY][A-HJ-PR-Y])\s?([0][2-9]|[1-9][0-9])\s?[A-HJ-PR-Z]{3})/;
    

提交回复
热议问题