Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • Both interesting and helpful - thanks. BTW, This problem is solvable by a pushdown stack automaton, which has more computational power than a regular expression - and this can easily be proved using the pumping lemma (en.wikipedia.org/wiki/Pumping_lemma) Commented Jan 10, 2009 at 19:45
  • Not true. The recursive structures in HTML (as tables in tables and many others) are surely not parseable by REs, but LINKs nor As are recursive in HTML, so you just needn't care about the recursive structures to get the links. Commented Mar 6, 2009 at 21:15
  • @jpalecek, you are incorrect. an A tag is most certainly recursive because the content of the A tag can contain another A tag. It might appear weird but it is certainly parsable HTML Commented Mar 6, 2009 at 21:17
  • No, A tag cannot contain A tags. From the HTML 4.01 DTD: "<!ELEMENT A - - (%inline;)* -(A)", the -(A) means there cannot be an A tag nested inside another A tag. XML DTDs cannot express this, but w3.org/TR/xhtml1/#prohibitions prohibits it. Commented Mar 6, 2009 at 21:28
  • 1
    @jpalecek, interesting. I usually approach these questions much more from a "is it parsable" than a "is it legal html" because websites tend to be on the side of the former. Even baring that you can still have an <a> literally inside it by embedding in a CDATA or literal string. Commented Mar 6, 2009 at 21:48