Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I want to exclude some unwanted words in an input field of textarea using the pattern function in HTML5.
so I want exclude word inside a text like 'viagra' and 'cialis'
How can I code this?
您可以使用此正则表达式:
^((?!viagra)(?!cialis).)*$
如帖子中所述:正则表达式匹配不包含单词的行?
你可以使用它
<input type="text" pattern="[^(^viagra$|^cialis$)]">