简体   繁体   中英

Pattern attribute HTML not matching regex

So I have this line of code:

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

but it doesn't seem to match anything at all.

I got it to work for more simple regex but not for this one.

I used a site to validate it and it looks like it's valid.

Change the wrapping quote and don't escape the chars other than the []

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM