3

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?

4

2 回答 2

7

您可以使用此正则表达式:

^((?!viagra)(?!cialis).)*$

如帖子中所述:正则表达式匹配不包含单词的行?

于 2012-12-14T09:41:08.703 回答
0

你可以使用它

<input type="text" pattern="[^(^viagra$|^cialis$)]"> 
于 2012-12-14T09:36:22.080 回答