title: regex match href without passing closing tag
body: <p>I am trying to create a regex to parse document links (pdf, ppt, xls, doc) in a html page. I have the regex as non-greedy but the issue I am seeing is the following:</p>
  
  <ul>
  <li>A href to a HTML page appears before the href to the document on the same line.</li>
  </ul>
  
  <p>In this case the regex matches from the start of the href for the HTML page to the end of the document file extension in the following href on the same line.</p>
  
  <p>Here's the regex I am using:</p>
  
  <pre><code>/href="\/cms\/(.*?\.(pdf|ppt|xls|doc))(\?.*?)?"/i
  </code></pre>
  
  <p>Here's some sample HTML to parse:</p>
  
  <pre><code>&lt;a href="/cms/medical/plans_overview.html"&gt;Medical&lt;/a&gt;&lt;/div&gt;&lt;a href="/cms/docs/mydoc.pdf"&gt; 
  </code></pre>
  
  <p>Currently this matches from the first href to the last pdf. Seems like I need to be able specify that I want the match as long as it doesn't pass a closing ">" in the expression but have not been able to figure this out.</p>
  
  <p>Would appreciate any help ...</p>