Add banned words list to the site I want to add a banned words list to the site. and if a user used one of the banned word in node form (title and body), comment form (title and body), user username in the registration form, then the user should get an error message that you are using a banned word in your {field-name}.

And the form should not be submitted if the banned words are present.

How can I do this?

I have checked some modules like wordfilter but it does not provide the functionality for usernames and also it replaces the strings not giving the error message.
Try the Profanity module, here is a quote about it from its project page:


  An alternative to Wordfilter and Phonetic Word Filter, this module
  provides...
  
  
  Filters any Entity! 
  The ability to create multiple word lists.
  Features exportable. 
  An input format filter for either replacing matched words with a repeated character or phrase. 
  Super quick no regex processing (for simple matching). 
  A function to use for custom form item validation/detection. 
  Tokens for title/label properties per Entity allowing you to specify which lists to process with. 
  A rule condition for "Text contains profanity" so you can do clever things    when bad words are detected (add to moderation queue). 
  Ability to filter Entity titles before view/render. 
  A view field for each Entity title, profanity filtered. 
  Validation to prevent users registering with a username containing profanity.
  Works with Search API by providing a filtered entity title property to be indexed. 
  Integration with Search API Views to provide a field for profanity filtered    Excerpt.
  


Note that it has Rules integration so you can send emails etc.