2
我在做什么错误,因为下面的两个字符串在下面测试时都返回false
?为什么不能让我的正则表达式工作?
var pattern = "^[\s\da-zA-ZåäöÅÄÖ_]+$"
var reg = new RegExp(pattern);
console.log(reg.test("This should be invalid as it is full with invalid chars. #!¤%&/()=?"));
console.log(reg.test("This is an valid string, despite that Swedish chars such as ÅÄÖ are used"));
嗨波蒂。从来不知道有两个通行证。但是,如上图所示,我仍然从'reg.test'返回'false',使用您的模式 – Industrial
@Industrial第二个测试字符串中有一个逗号。 – Pointy
该死!我需要新的眼镜。非常感谢,波蒂 – Industrial