Allow “/” forward slash in regular expression

后端 未结 2 1841
余生分开走
余生分开走 2020-12-11 17:20
var patt = /^(?=.*[a-zA-Z0-9.!@#&*\\-\\u0080-\\u052F])[a-zA-Z0-9\\s.!@#&*\',\\-\\u0080-\\u052F]*$/;
console.log(patt.test(\"\\u002f\"));

I

2条回答
  •  盖世英雄少女心
    2020-12-11 18:11

    You can escape a / character, by using \/.

    Using unicode will actually result in the absolute same result, as using the character itself - and therefore will not solve your problem.

提交回复
热议问题