非法字符验证

发表于 2023-11-01 23:39:21   |   下载附件   |   字体:
非法字符验证字符检测表单验证
function test(text) {
    if (text.match(/[\!\@#\$\%\^\&\*\(\)\+\=\-\[\]\\\'\;\,\/\{\}\|\"\:\<\>\?]/)) {
        alert('非法字符');
    }
}
test('&')