On 15 Aug 2012, at 8:39 AM, Anthony <abasta...@gmail.com> wrote: > In that case, you'd want: > > BADWORDS = re.compile(r'ass|jerk|otherbadword|etc') > > or if you already have a list or want to use the list in other places: > > badlist = ['ass', 'jerk', 'etc'] > BADWORDS = re.compile(r'|'.join(badlist)) > > Anthony
You'd also want to add word boundaries r'\b' to the RE, to avoid false positives on eg 'assert'. --