Note that there are some explanatory texts on larger screens.

plurals
  1. POpreg_match_all starting from specific html tag and ending with it
    primarykey
    data
    text
    <p>I have a source page with a table which consists of 15 rows with this content:</p> <pre><code>&lt;tr class="hlRow" onclick="window.location=link11.href" onmouseover="rowOver(11)" onmouseout="rowOut(11,'#cad9ea')"&gt; &lt;td class="row3"&gt;Latest news&lt;/td&gt; &lt;td class="row3" id="row_6_11"&gt;&lt;a onclick="servOC(11,'/link-to-page.html','',ihTri11)"&gt;&lt;img class="tog" id="ihTri11" src="up.png" title="Toggle" height="19" width="19" /&gt;&lt;/a&gt;14.7w&lt;/td&gt; &lt;td class="row3" id="name11"&gt;&lt;a href="/link-to-page.html" style="float: right; color: green; font-weight: bold;" title="+2 rating, 2 comments"&gt;+2&lt;img src="star.png" alt="rating" style="margin-left: 1px;" height="12" width="12" /&gt; 2&lt;img src="bubble.png" alt="comments" style="margin-left: 2px;" height="10" width="10" /&gt;&lt;/a&gt;&lt;a id="link11" href="/link-to-page.html"&gt;Got to page&lt;/a&gt;&lt;/td&gt; &lt;td class="row3" title="11 files"&gt;10 days&lt;/td&gt; &lt;td class="row3"&gt;104&lt;/td&gt; &lt;td class="row3"&gt;108&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Basically I need to take those rows between <code>&lt;tr&gt;</code> to <code>&lt;/tr&gt;</code> tags from source site and show them on mine. I've tried using <code>preg_match_all()</code>, but as my regex experience is very limited I just can't do it properly.</p> <pre><code>preg_match_all('&lt;tr class="hlRow"(.*?)&lt;/td&gt;&lt;/tr&gt;/i', $turinys, $linkai, PREG_SET_ORDER); foreach ($linkai as $linkas) {$a1 = $linkas[1]; echo "&lt;table&gt;&lt;tr class=\"hlRow\"".$a1."\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";} </code></pre> <p>Even more awesome would be to get only contents from inside of <code>&lt;td&gt;</code> tags and then foreach those on my page.</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.
 

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