简体   繁体   中英

I would like to add quotes to a regex expression in an HTML tag

Here's some code:

<form>
<input type="text" name="Title" pattern="[a-zA-Z0-9`\~\!\@\#\$\%\^\&\*\(\)\-\\\\=\+\{\}\[\]\']{2,40}" required>
<input type="submit">
</form>

I would like to add quotes to the allowed in the regex expression, however \\" does not work and &quot does not work, either...

So I can just replace the quotes with \\x22 . Now I'll have to figure out which one to use (I can instead disallow instead of allow, or use \\x22 in place of the quotes). I can't remember all of the original reasons I chose to specifically allow, so I might stick with replacing it with \\x22 , since it's so simple and less modifying.

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