我想知道如何将带有括号的特殊字符部分(如 {} [] () 和其他内容(如“')添加到我在下面尝试的唯一字符中,但由于某种原因,当我添加另一个字符时它停止工作.
<-- works but does not have any brackets or quotes for special character-->
<form acton = "#">
<input type="password" id="newPass" required
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*?[0-9])(?=.*?[!@#$%^&*+`~=?\|<>/]).{8,}"
<button>submit</button>
</form>
上面的部分有效,但没有引号或更多特殊字符
下面的代码有括号但不起作用
<-- does not work (if you do not enter special character user will be able to submit but it does not have any brackets -->
<form acton = "#">
<input type="password" id="newPass" required
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*?[0-9])(?=.*?[~`!@#$%^&*()-_=+[]{};:'.,"\|/?><]).{8,}"
<button>submit</button>
</form>
这也不起作用(来自答案)
<form acton = "#">
<input type="password" id="pass" required
pattern="(?=.*\d)(?=.*[a-z])(?=.*?[0-9])(?=.*?[~`!@#$%\^&*()\-_=+\[\]{};:\'.,\"\\|/?\>\<]).{4,}">
<button>submit</button>
</form>
我正在寻找一个使底部(带括号的那个和我包括的所有特殊字符)有效的答案。
森栏
慕妹3146593
MYYA
相关分类