From: David W. <wo...@cs...> - 2008-02-29 22:23:58
|
Alright, I've replaced the Pattern regex with "(.*?)", and that found a few bugs in other patterns (which were doing the wrong thing with greedy/non-greedy regexes). I've fixed that and added a simple test case in rev 83. On 29-Feb-08, at 4:30 PM, Waylan Limberg wrote: > I was going to make that change myself and have tested it. However, I > never did commit it because it would seem to me that wrapping the > patterns in (.*) is unnecessary. However, the reliance on those goes > deeper that I initially thought. So, sure, if your satisfied that the > tests pass, go ahead and make that change. > > We may come upon a few edge cases later and have to tweak a few of the > patterns, but so be it. Personally, I think a few of them could be > reworked anyway. I just haven't taken the time to do it. > > On Fri, Feb 29, 2008 at 3:51 PM, David Wolever > <wo...@cs...> wrote: >> At the moment, the Pattern class defaults to using the regular >> expression ``^(.*)<user patter>(.*)$`` to match everything. This >> becomes problematic, however, if the user's pattern has an optional >> prefix (ie: ``(\!?stuff)`` -- the ! (if it exists) will be >> matched as >> part of the (.*) instead of the (\!?stuff)). >> >> I've replaced the regular expression with ``^(.*?)%s(.*?)$`` -- the >> non-greedy sides should do the trick (at least in my situation). >> >> Now, is there any reason this shouldn't be used generally? I can't >> think of any expression which it would break... But, admittedly, my >> regex-foo is low. >> >> Thanks, >> David >> >> >> --------------------------------------------------------------------- >> ---- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Python-markdown-discuss mailing list >> Pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss >> > > > > -- > ---- > Waylan Limberg > wa...@gm... |