Bugs item #1456280, was opened at 2006-03-22 17:34
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1456280&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Regular Expressions
Group: Python 2.4
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Wolfgang Grafen (grafen)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: Traceback error when compiling Regex
Initial Comment:
Traceback error when compiling the following regular
expression. Error discovered with Python 2.4.2.
Used pre from python2.3 to check the validity of
re_fmt. With pre it works fine.
Question:
I submitted a sre error report before and I warned
to take off pre from the library. It is of advantage
to be able to check a failing re with pre. Personally
I feel sre has still too many bugs to completely
substitute pre.
Regards
Wolfgang Grafen
======================================================
chios scalar 582 % ./fmtscalar.py
Traceback (most recent call last):
File "./fmtscalar.py", line 21, in ?
re_fmt = re.compile(
File "/user/freepool/local/lib/python2.3/sre.py",
line 179, in compile
return _compile(pattern, flags)
File "/user/freepool/local/lib/python2.3/sre.py",
line 230, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
---- cut here ----
#!/usr/bin/env python2.3
# -*- coding: Latin-1 -*-
import sre as re
re_fmt = re.compile(
"("
"%"
"(?P<precision>"
"\d+"
"(?:"
"[.]"
"\d+"
")"
")?"
"(?:"
"[(]"
"(?P<key>"
"[^)]*"
")?"
"[)]"
")?"
"(?P<c>[a-z])"
")"
)
a="%s"
b="aber%sxyz"
c="aber%3.1i"
c="aber%(quengel)s"
for i in a,b,c:
m = re_fmt.findall(i)
print i,m
---- cut here ---
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2006-06-01 13:46
Message:
Logged In: YES
user_id=849994
Duplicate of #214033.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1456280&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com