Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Is there a way in regex to specify that if it finds another table tag within the match to keep to ignore the next match of and go for the next one and so on?</p> </blockquote> <p>Since nobody's actually answered this part, I will—No.</p> <p>This is part of what makes regular languages "regular". A <a href="http://en.wikipedia.org/wiki/Regular_language" rel="nofollow">regular language</a> is one that can be recognized by a certain regular grammar, often described in syntax that looks very much like basic regular expressions (<code>10*</code> to match <code>1</code> followed by any number of <code>0</code>s), or a <a href="http://en.wikipedia.org/wiki/Deterministic_finite-state_machine" rel="nofollow">DFA</a>. "Regular Expressions" are based strongly off of these regular languages, as their name implies, but add some functions such as <a href="http://www.regular-expressions.info/refadv.html" rel="nofollow">lookaheads and lookbehinds</a>. As a general rule, a regular language knows nothing about what's around it or what it's seen, only what it's looking at currently, and which of its finite states it's in.</p> <p><strong>TLDNR:</strong> Why does this matter to you? Since a regular language cannot "count" elements in that way, it is impossible to keep a tally of the number of <code>&lt;table&gt;</code> and <code>&lt;/table&gt;</code> elements you have seen. An HTML Parser does just that - since it is not trying to emulate a regular language, it can count the number of opening and closing tags it sees.</p> <p>This is the prime example of why it's best not to use regular expressions to parse HTML; even though you know how it may be formed, you cannot parse it since there may be nested elements. If you could guarantee there would be no nested tables, it may be feasible to do this, but even then, using a parser would be much simpler.</p> <hr> <p><sub>Plea to the theoretical computer scientists: I did my best to explain what I know from the CS Theory classes I've taken in a way that most people here should be able to understand. I know that regular languages can "count" finite numbers of things. Feel free to correct me, but please be kind!</sub></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload