title: Find IP addresses in SQL Server
body: <p>I have over 10 million records that contain an IP address in SQL Server. I need to parse out the addresses into a separate column to further analyze them. I have tried using a PATINDEX which works but only covers one pattern for the IP address. The first octet has to be 50, 41, or 107. The other three octets can range from single to triple digits. Here is what I used which catpures 50/41/107.xxx.xxx.xxx:</p>
  
  <pre><code>SELECT  SUBSTRING(Column_1,PATINDEX('%[50|41|107].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9]%',Column_1)-2,14)
  FROM    table_1
  </code></pre>
  
  <p>How can I capture all IP patterns (50.x.xxx.xxx, 50.xx.x.xxx, etc...) in one query?</p>