簡體   English   中英

模式屬性 HTML 不匹配正則表達式

[英]Pattern attribute HTML not matching regex

所以我有這行代碼:

 <form> <input max="250" required pattern="[A-Za-z0-9 \.\,\?\:\:\[\]\(\)\"\-\+]+" class="inputBox" type="text" id="comment" name="CommentContent" placeholder="write here"> </form>

但它似乎根本不匹配任何東西。

我讓它適用於更簡單的正則表達式,但不適用於這個。

我使用了一個站點來驗證它,它看起來是有效的。

更改包裝引號,不要轉義 [] 以外的字符

 <form> <input max="250" required pattern='[A-Za-z0-9.,?::\[\]()"-+]+' class="inputBox" type="text" id="comment" name="CommentContent" placeholder="write here"> </form>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM