ask for a RE pattern to match TABLE in html

David C. Ullrich dullrich at sprynet.com
Fri Jun 27 19:32:04 CEST 2008


In article 
<62f752f3-d840-42de-a414-0d56d15d7c5a at w4g2000prd.googlegroups.com>,
 Jonathan Gardner <jgardner at jonathangardner.net> wrote:

> On Jun 26, 3:22 pm, MRAB <goo... at mrabarnett.plus.com> wrote:
> > Try something like:
> >
> > re.compile(r'<table\b.*?>.*?</table>', re.DOTALL)
> 
> So you would pick up strings like "<table><tr><td><table><tr><td>foo</
> td></tr></table>"? I doubt that is what oyster wants.

I asked a question recently - nobody answered, I think
because they assumed it was just a rhetorical question:

(i) It's true, isn't it, that it's impossible for the
formal CS notion of "regular expression" to correctly
parse nested open/close delimiters?

(ii) The regexes in languages like Python and Perl include
features that are not part of the formal CS notion of
"regular expression". Do they include something that
does allow parsing nested delimiters properly?

-- 
David C. Ullrich



More information about the Python-list mailing list