> My (probably to naive) approach is: p = re.compile(r'\b#include\b) I think your problem is the \b at the beginning. \b matches a word break (defined as \w\W or \W\w). There would only be a word break before the # if the preceding character were a \w (that is, [A-Za-z0-9_], and maybe some other characters depending on your locale).
However, the \b after the "include" is exactly what you want. -- I had picked out the theme of the baby's room and done other things. I decided to let Jon have this. - Jamie Cusack (of the Netherlands), whose husband Jon finally talked her into letting him name their son Jon 2.0 -- http://mail.python.org/mailman/listinfo/python-list