Word restriction

0

Speak, people.

I would like to know how to restrict certain words, like, a person tries to write 'PQP', so the site does not let this word stay there.

HTML5 - CSS - JS

    
asked by anonymous 28.08.2016 / 06:55

1 answer

1

Good though you can do in HTML as well.

<form action="">
  Palavra : <input type="text" name="palavra" pattern="^((?!PQP).)*$">
  <input type="submit">
</form>

In this way the string "PQP" is not allowed. If the answer is correct, you could validate it.

To assemble expressions for multiple words you will need the "or" ("|") operator.

Here you can see how to make expressions

    
28.08.2016 / 11:09