#!/usr/local/bin/python2 import re r = re.compile('[^!]') print r.match('ka')