[英]ng-pattern for alphanumeric and all special symbol characters
In input, I need to allow alphanumeric and all special symbol character. 在输入中,我需要允许字母数字和所有特殊符号字符。 I am using the following pattern.
我使用以下模式。 Unfortunatelly, it is not working.
不幸的是,它没有用。
ng-pattern="/^[ A-Za-z0-9_@./#$=!%^)(]:*;?/\,}{'|<>[&+-]*$/"
You missed to escape all the characters that should be excaped with \\
. 你错过了逃脱所有应该用
\\
替换的角色。 The following may work: 以下可能有效:
ng-pattern="/^[A-Za-z0-9_@.#$=!%^)(\]:\*;\?\/\,}{'\|<>\[&\+-]*$/"
Note that it could be simplified to: 请注意,它可以简化为:
ng-pattern="/^[A-z\d_@.#$=!%^)(\]:\*;\?\/\,}{'\|<>\[&\+-]*$/"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.