def containsAtLeastOneWord(name, words):
 if isinstance(words, basestring):
  words = words.split(u',')
 items = [(re.compile((u'(^|[\\W_])%s($|[\\W_])' % re.escape(word.strip())), re.I), word.strip()) for word in words]
 for (regexp, word) in items:
  if regexp.search(name):
   return word
 return False

def containsAtLeastOneWord ( name , words ) : if isinstance ( words , basestring ) : words = words . split ( u',' ) items = [ ( re . compile ( ( u'(^|[\\W_])%s($|[\\W_])' % re . escape ( word . strip ( ) ) ) , re . I ) , word . strip ( ) ) for word in words ] for ( regexp , word ) in items : if regexp . search ( name ) : return word return False
filters out results based on filter_words name: name to check words : string of words separated by a .