Author Mike.Lissner
Recipients Mike.Lissner, docs@python
Date 2017-01-18.20:21:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484770875.58.0.864108991771.issue29315@psf.upfronthosting.co.za>
In-reply-to
Content
I just ran into a funny corner case I imagine others are aware of. When you write "\b" in Python, it is a single character: "\x08". So if you try to write a regex like:

words = '\b(.*)\b'

That won't work. But using a raw string will:

words = r'\b(.*)\b'

As will escaping it in this horrible fashion:

words = '\\b(.*)\\b'

I believe this doesn't affect any of the other regex flags, so I wonder if it's worth adding something to the docs to warn about this. I just spent a bunch of time trying to figure out why it seemed like \b wasn't working. A little tip in the docs would have gone a LONG way.
History
Date User Action Args
2017-01-18 20:21:15Mike.Lissnersetrecipients: + Mike.Lissner, docs@python
2017-01-18 20:21:15Mike.Lissnersetmessageid: <1484770875.58.0.864108991771.issue29315@psf.upfronthosting.co.za>
2017-01-18 20:21:15Mike.Lissnerlinkissue29315 messages
2017-01-18 20:21:15Mike.Lissnercreate