title: Using PATINDEX to find varying length patterns in T-SQL
body: <p>I'm looking to pull floats out of some varchars, using PATINDEX() to spot them. I know in each varchar string, I'm only interested in the first float that exists, but they might have different lengths. </p>
  
  <p>e.g.</p>
  
  <pre><code>'some text 456.09 other text'
  'even more text 98273.453 la la la'
  </code></pre>
  
  <p>I would normally match these with a regex </p>
  
  <pre><code>  "[0-9]+[.][0-9]+"
  </code></pre>
  
  <p>However, I can't find an equivalent for the + operator, which PATINDEX accepts. So they would need to be matched (respectively) with:</p>
  
  <pre><code>'[0-9][0-9][0-9].[0-9][0-9]' and '[0-9][0-9][0-9][0-9][0-9].[0-9][0-9][0-9]' 
  </code></pre>
  
  <p>Is there any way to match both of these example varchars with one single valid PATINDEX pattern?</p>