title: SQL: How to parse a string only where certain character patterns exist
body: <p>I'm aware of using various functions like <code>CHARINDEX</code> and <code>PATINDEX</code>, but only for a single &quot;spot&quot; in a string. What I'm needing to do is parse out the characters of a string that exist between a <code>&lt;</code> and <code>&gt;</code>. For example:</p>
  <pre><code>&lt;ul&gt;&lt;li&gt;Good afternoon,&lt;br /&gt;&lt;br /&gt;Please see the NDC number listed on the attached delivery ticket.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;&lt;br /&gt;Rebecca Lawrence&lt;br /&gt;Clinical Pharmacist&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;From: Merino,Jason L &lt;JLMerino@email.com&gt; &lt;br /&gt;Sent: Monday, September 12, 2022 1:17 PM&lt;br /&gt;To: YYY &lt;Pharmacy@email.com&gt;&lt;br /&gt;Subject: NDC number&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hello! Could I please get the NDC number for Lewis Trantham's ID number 24628 medication? I just received it and it is not listed.  &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Thank you!&lt;br /&gt;Jason Merino&lt;br /&gt;Office Coordinator&lt;br /&gt;Specialty Clinic of City&lt;br /&gt;(555) 555-5555&lt;/li&gt;&lt;/ul&gt;
  </code></pre>
  <p>So it could be <code>&lt;br&gt;</code>, <code>&lt;br /&gt;</code>, <code>&lt;[email_address]&gt;</code>, etc. Given the range of possibility of text that could exist here, I have no idea how to go about removing these bits of characters. As stated, I'm only aware of how to do this when the string is much more predictable. And this is stored as a <code>VARCHAR</code> by the way.</p>