title: How can I extract certain HTML tags e.g. <ul> using Regex with preg_match_all in PHP?
body: <p>I am new to regular expressions. I want to fetch some data from a web page source. I used
  <code>file_get_contents("url")</code> to get the page's HTML source. Now I want to capture a portion within some special tags.</p>
  
  <p>I found <code>preg_match_all()</code> works for this. Now I want some help to solve my problem and if possible help me to find out how to solve similar problems like this.</p>
  
  <p>In the example below, how would I get the data within the <code>&lt;ul&gt;</code>?
  (I wish this sample HTML code could be easier for me to understand.)</p>
  
  <pre><code>&lt;div class="a_a"&gt;qqqqq&lt;span&gt;www&lt;/span&gt; &lt;/div&gt;
  &lt;ul&gt;
  &lt;li&gt;
      &lt;div class="a_a"&gt;&lt;h3&gt;aaaa&lt;/h3&gt; aaaa aaaaa&lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
      &lt;div class="b_b"&gt;bbbbb &lt;span class="s-s"&gt;bbbb&lt;/span&gt; bbbb&lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
      &lt;div class="c_c d-d"&gt;cccc cccc ccccc&lt;/div&gt;
  &lt;/li&gt;
  &lt;/ul&gt;
  &lt;table&gt;
  &lt;tr&gt;
      &lt;td&gt;sdsdf&lt;/td&gt;
      &lt;td&gt;hjhjhj&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;yuyuy&lt;/td&gt;
      &lt;td&gt;ertre&lt;/td&gt;
  &lt;/tr&gt;   
  &lt;/table&gt;
  </code></pre>