Edward K. Ream wrote:

> Here is a little regular expression puzzle.  I wish a regex that matches
> an rst code block, that is,

> '::' followed by a group of lines all indented by at least as much as the
> first non-blank line following the '::'
 
> My guess is that this is not possible.  Can anyone prove me wrong :-)

Try

r"(::\s*\n(\s*\n)*((\s+).*?\n)(((\4).*?\n)|(\s*\n))*)"

Probably buggy and too complicated, but you didn't post a good test suite...

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to