![](/img/trans.png)
[英]RegExp is not getting validated and only consequent check is happening for two small letters
[英]Regexp with letters and -
我需要一個帶有字母和-的正則表達式,以用作輸入類型文本的模式驗證,例如:
<input type="text" name="name" id="name" class="form-control" placeholder="name form" pattern="[A-Za-z-]" required="required">
但是當我填寫和求和表格時,它仍然還會驗證其他字符。
您可以使用以下模式( [A-Za-z\\-]+
)檢查整個輸入:
<input type="text" name="name" id="name" class="form-control" placeholder="name form" pattern="[A-Za-z\-]+" required="required">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.