title: How to regex scrape HTML and ignore whitespace and newlines in code?
body: <p>I'm putting together a quick script to scrape a page for some results and I'm having trouble figuring out how to ignore white space and new lines in my regex.</p>
  
  <p>For example, here's how the page may present a result in HTML:</p>
  
  <pre><code>&lt;td class="things"&gt;
      &lt;div class="stuff"&gt;
          &lt;p&gt;I need to capture this text.&lt;/p&gt;
      &lt;/div&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>How would I change the following regex to ignore the spaces and new lines:</p>
  
  <pre><code>$regex = '/&lt;td class="things"&gt;&lt;div class="stuff"&gt;&lt;p&gt;(.*)&lt;\/p&gt;&lt;\/div&gt;&lt;\/td&gt;/i';
  </code></pre>
  
  <p>Any help would be appreciated. Help that also explains why you did something would be greatly appreciated!</p>