title: Efficient way to search for invalid characters in python
body: <p>I am building a forum application in Django and I want to make sure that users dont enter certain characters in their forum posts. I need an efficient way to scan their whole post to check for the invalid characters. What I have so far is the following although it does not work correctly and I do not think the idea is very efficient.</p>
  
  <pre><code>def clean_topic_message(self):
      topic_message = self.cleaned_data['topic_message']
      words = topic_message.split()
      if (topic_message == ""):
          raise forms.ValidationError(_(u'Please provide a message for your topic'))
      ***for word in words:
          if (re.match(r'[^&lt;&gt;/\{}[]~`]$',topic_message)):
              raise forms.ValidationError(_(u'Topic message cannot contain the following: &lt;&gt;/\{}[]~`'))***
      return topic_message
  </code></pre>
  
  <p>Thanks for any help.</p>