[docs] [issue10875] Update Regular Expression HOWTO

Terry J. Reedy report at bugs.python.org
Sun Jan 9 21:20:09 CET 2011

New submission from Terry J. Reedy <tjreedy at udel.edu>:

0. Does 'Release 0.05' at the top have any useful current meaning?
or could it be deleted?

1. Introduction:

The history paragraph "The re module was added in Python 1.5, and provides Perl-style regular expression patterns. Earlier versions of Python came with the regex module, which provided Emacs-style patterns. The regex module was removed completely in Python 2.5." might be eliminated in 3.x, or at least the irrelevant-for-py3 reference to regex. This is a policy decision.

2. Performing matches:

"If you have Tkinter available, you may also want to look at Tools/scripts/redemo.py,"

Change 'Tkinter' to 'tkinter' and make it a module reference.
In link, change 'scripts' to 'demo' as redemo.py got moved.

"Phil Schwartz’s Kodos is also an interactive tool for developing and testing RE patterns."

Add the url '(http://kodos.sourceforge.net/)' to the text so that Windows help users can copy and paste it into a browser. (This should be a general policy.)

"Python 2.2.2 (#1, Feb 10 2003, 12:57:01)"

<_sre.SRE_Match object at 80c4f68>

This is correctly updated (for late 2.x and 3.x)

"<re.MatchObject instance at 80c9650>" (7 like this)

Globally replace 're.MatchObject instance' with '_sre.SRE_Match object'

3. Footnote

"[1] Introduced in Python 2.2.2."

remove for 3.x here and wherever footnote reference is in the text.

4. "Not Using re.VERBOSE"

This section is about *using* re.VERBOSE and the benefit thereof, not about not using it. I recommend deleting 'Not' as it gives the impression that the section is a warning about not using, the opposite of the intent.

5. Code example output and doctest:

I ran doctest.testfile("C:/programs/PyDev/py32/Doc/howto/regex.rst", module_relative = False)

After the 're...' to '_sre...' substitution above, all 11 failures would be due to 'at 0x#######' address mismatches. I believe changing all 11 addresses to '0x...' (I took this from the doctest doc) would both fix the failures and remove irrelevant detail for human readers.

The other 87 examples all passed ;-!.

Is there any current doctest-related markup that should be added?

assignee: docs at python
components: Documentation
messages: 125855
nosy: akuchling, docs at python, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Update Regular Expression HOWTO
versions: Python 2.7, Python 3.1, Python 3.2

Python tracker <report at bugs.python.org>

More information about the docs mailing list