title: SQL - Extract Substring
body: <p>Not great with SQL and am kind of stuck as to which expression to use.  I was thinking a &quot;case when&quot; could help me here.</p>
  <p>So I have a messy dataset that contains a mixture of information.
  I am trying to write a SQL statement that would extract only the rows which contain text in the following format:
  &quot;ID [Int][Int][Int][Int][Int]&quot; or &quot;ID[Int][Int][Int][Int][Int]&quot;.</p>
  <p>ID # is always 5 integers [0-9].
  Sometimes there is no space between ID and the start of the integer.</p>
  <p>The logic is essentially this:</p>
  <ul>
  <li>If (Name) contains &quot;ID 12345&quot; then return &quot;ID 12345&quot; in a separate column.</li>
  <li>If (Name) contains &quot;ID54321&quot; then return &quot;ID 54321&quot; in a separate column.</li>
  </ul>
  <p>Example:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Name</th>
  <th style="text-align: center;">Normalized Name</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">John Smith ID 12345</td>
  <td style="text-align: center;">ID 12345</td>
  </tr>
  <tr>
  <td style="text-align: left;">Hello ID54321 Hello</td>
  <td style="text-align: center;">ID 54321</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Any assistance you could provide would be greatly appreciated. Thank you!</p>