Re: regexp weirdness (bug?)

2005-04-06 Thread Andrà Malo
* Fredrik Lundh wrote: > Sergey Schetinin wrote: > >> it's line #159 here, but it did work! thanks. so it IS a bug? > > sure looks like one. please report it here: > > http://sourceforge.net/tracker/?group_id=5470&atid=105470 done :) nd -- "Das Verhalten von Gates hatte mir bewiesen, da

Re: regexp weirdness (bug?)

2005-04-05 Thread Andrà Malo
* Fredrik Lundh wrote: > André Malo wrote: > >> No, I suppose they shouldn't compile. >> _re_pair should be (?P=plus). > > the (?(NAME)RE|RE) form was added in 2.4. > > looks like a bug to me; the "plus" group is set to "+" in all four cases, > so the > final pattern should match. but I might

Re: re module non-greedy matches broken

2005-04-05 Thread Andrà Malo
* lothar wrote: As already said by Georg, regexes are the wrong tool for such tasks, but anyway... > give an re to find every innermost "table" element: ]*)?>[^<]*(?:<(?!/table>|table(?:\s[^>]*)?>)[^<]*)* > give an re to find every "pre" element directly followed by an "a" > element: ]*)?>[^<]

Re: re module non-greedy matches broken

2005-04-05 Thread Andrà Malo
* lothar wrote: > a non-greedy match - as implicitly defined in the documentation - is a > match in which there is no proper substring in the return which could also > match the regex. Your argumentation is starting at the wrong place. The documentation doesn't define the bahviour, it tries to de

Re: regexp weirdness (bug?)

2005-04-05 Thread Andrà Malo
* Sergey Schetinin wrote: > Here's the session log: > _re_pair="(?(plus).|-)" _re1=("(?P\+)"+_re_pair) _re2=("((?P\+))"+_re_pair) _re3=("(?:(?P\+))"+_re_pair) _re4="(%s)"%_re3 import re print [re.match(_re, "+a") and 'match' for _re in [_re1, _re2, > _re3, _re4]

Re: re module non-greedy matches broken

2005-04-03 Thread Andrà Malo
s still start matching the leftmost. So instead the longest of the leftmost you get the shortest of the leftmost. One may consider this as a documentation bug, yes. nd -- # Andrà Malo, <http://www.perlig.de/> # -- http://mail.python.org/mailman/listinfo/python-list

Re: testing -- what to do for testing code with behaviour dependant upon which files exist?

2005-04-02 Thread Andrà Malo
ncapsulate the os.path.isfile call in an own method, which can be overridden by your test. nd -- # Andrà Malo, <http://pub.perlig.de/> # -- http://mail.python.org/mailman/listinfo/python-list