title: Index matching patter to any digit
body: <p>Having in account my last <a href="https://stackoverflow.com/questions/64770859/sql-pattern-matching-not-giving-the-correct-output">question</a>, another problem emerged: I also need to find a pattern for any number, with no limit of digits. I also made some changes: I now have a test table with a column containing only numbers and what I intend to do is to those records who do not match the pattern in the previous question, I want them to follow it again, but including numbers with more than one digit.</p>
  <p>Just to provide more context, this is the initial state of the table:</p>
  <p><a href="https://i.stack.imgur.com/VCyST.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VCyST.png" alt="enter image description here" /></a></p>
  <p>What I tried was to simply add the &quot; * &quot;, like below:</p>
  <pre><code>UPDATE dbo.Test
  SET     ToJsonTestValue = '[&quot;' + ToJsonTestValue + '&quot;]'
  WHERE ToJsonTestValue NOT LIKE '[[]&quot;[0-9]*&quot;[\]]' ESCAPE '\';
  </code></pre>
  <p>and at a first glance it seemed ok, in the first execution of the query, it just added the pattern I wanted. But when I executed the query a second time, in order to verify that those who already had the pattern would be ignored, the result was this:</p>
  <p><a href="https://i.stack.imgur.com/HWC0Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HWC0Y.png" alt="enter image description here" /></a></p>
  <p>I also tried without the &quot; * &quot;, which works fine but then again, it wont cover all cases (numbers with more than one digit). Without the &quot; * &quot; makes the one digit numbers with the pattern be ignored, which was good, but not sufficient for the task.
  This being said, is there a way to solve this stress? Thanks in advance.</p>