Python 1.5.2->2.0 documented incompat.?
Fredrik Lundh
effbot at telia.com
Sun Oct 22 08:42:27 EDT 2000
Daniel Hops wrote:
> I just installed the new Pyton 2.0 on my SUN Solaris machine and tried
> my current script with it, but got an error.
> Changing the 1st line of the script back to 1.5.2 binary helps.
> The error is related with regular expression matching.
quoting the documentation:
Implementation note: The re module has two distinct
implementations: sre is the default implementation and
includes Unicode support, but may run into stack limitations
for some patterns. Though this will be fixed for a future
release of Python, the older implementation (without
Unicode support) is still available as the pre module.
to use pre in a single script, just replace "import re" with
"import pre as re"
> I get an attribute error: "None has no attribute group"
this means that you didn't check the return value; match and
search returns None if the pattern didn't match.
> And that is the precompiled r.e.:
> all = re.compile
> ("(?P<head>\A.*?</TR>\s+)(?P<main>.*?)(?P<bottom></TABLE>(?!.*</TABLE>).*)",
> re.S)
there are way too many ".*"s in that pattern for me to tell why
you're getting this error... can you come up with a self-contained
sample script? (if so, mail it to me or post it to the bug manager at
sourceforge).
</F>
More information about the Python-list
mailing list