Regular expression to match a #
dan at cellectivity.com
Thu Aug 11 13:26:01 CEST 2005
> 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
More information about the Python-list