Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
请指导我隐藏这个正则表达式
“A - Z”, “a - z”,”0 - 9” and “-, _/, \”.
在 javascript 中使用
将正则表达式放在斜杠之间:var regex = /^[a-zA-Z0-9\-_[\]\\/]*$/;.
var regex = /^[a-zA-Z0-9\-_[\]\\/]*$/;
尝试
var rg = new RegExp("^[a-zA-Z0-9\-_[\\]\\/]*$");
或者
var rg = /^[a-zA-Z0-9-_[\]\/]*$/;
javascript 中没有类型引用,所有变量都将使用声明var,正则表达式类型为RegExp
var
RegExp