Whitespace is actually \s. But [\s]disc[whatever]
doesn't do the job - then it won't match "(disc)",
which counts as "disc appearing as a full word.
Ok, then this works:
import re
test = """
disc
(disc)
foo disc bar
discuss
""".split("\n")
for t in test:
if re.search(r"(^|[^\w])(disc)($|[^\w])", t):
print "success:", t
Also I think you have ^ and $ backwards, and there's
a ^ I don't understand. I _think_ that a correct version
Yep, sorry for the confusion.
Diez
--
http://mail.python.org/mailman/listinfo/python-list