[英]Regular Expression for Alphanumeric characters and - / only
Trying to work on a regular expression in javascript that allows alphanumeric characters excludes most unique characters except - / 尝试使用允许字母数字字符的javascript中的正则表达式来排除大多数唯一字符,但-/
validateDesc: function(desc) {
var matches = /^[a-zA-Z\d\-_.,\s]+$/;
return matches.test(desc);
}
The one above I've tried to make only allowing alphanumeric, what do I have to add to make that happen? 上面我试图只允许字母数字的那个,我必须添加些什么才能实现呢? If anyone could give any insight on how to add other unique characters as well that would be greatly appreciated. 如果有人能对如何添加其他唯一字符提供任何见解,也将不胜感激。
Regular expressions need delimiters. 正则表达式需要定界符。 And be sure to include /
if you want that to match. 并且如果要匹配,请确保包含/
。
validateDesc: function(desc) {
var matches = /^[a-zA-Z0-9\-_., \t\/]+$/;
return matches.test(desc);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.