Overwriting the AngularJS URL validator

后端 未结 3 1175
灰色年华
灰色年华 2021-01-18 08:45

AngularJS accepts this for a valid URL:

var URL_REGEXP = /^(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?$/;         


        
3条回答
  •  粉色の甜心
    2021-01-18 09:34

    You can use the ng-pattern attribute to strengthen the pattern used for validation. (I haven't seen a way to weaken the pattern used--perhaps this is a good thing though.)

提交回复
热议问题