How to escape # hash character in regex match strings

Rhodri James rhodri at
Thu Jun 11 18:12:38 EDT 2009

On Thu, 11 Jun 2009 15:22:44 +0100, Brian D <briandenzer at> wrote:

> I'm surprised it's been so difficult to find an example of the hash
> character in a RegEx string -- for exactly this type of situation,
> since it's so common in the real world that people want to put a pound
> symbol in front of a number.

It's a character with no special meaning to the regex engine, so I'm not
in the least surprised that there aren't many examples containing it.
You could just as validly claim that there aren't many examples involving
the letter 'q'.

By the way, I don't know what you're doing but I'm seeing all of your
posts twice, from two different addresses.  This is a little confusing,
to put it mildly, and doesn't half break the threading.

Rhodri James *-* Wildebeest Herder to the Masses

More information about the Python-list mailing list