import re

rex = re.compile(r'^([^\\]*)(\\.[^.^$*+?{}\[\]|()\\]*)*[.^$*+?{}\[\]|()]', re.MULTILINE)

arr = [r"example", r"foo\.bar", r"e.ample", r"foo\\.bar", r"foo\\bar\.baz", r"foo\\bar.baz", r"foo(bar)"]

for s in arr:
	print s, re.search(rex, s) != None

	