Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 pattern exclude words

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?

like image 366
eric Avatar asked Mar 27 '26 05:03

eric


1 Answers

You can use this regex :

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

As explained in the post : Regular expression to match a line that doesn't contain a word?

like image 96
Pilou Avatar answered Mar 29 '26 22:03

Pilou