title: How to find a specific string followed by a number, with any number of characters between?
body: <p>I'm trying to write a regex for the following pattern:</p>
  
  <blockquote>
    <p>[MyLiteralString][0 or more characters without restriction][at least 1 digit]</p>
  </blockquote>
  
  <p>I thought this should do it: </p>
  
  <pre><code>(theColumnName)[\s\S]*[\d]+
  </code></pre>
  
  <p>As it looks for the literal string <code>theColumnName</code>, followed by any number of characters (whitespace or otherwise), and then at least one digit. But this matches more than I want, as you can see here:</p>
  
  <p><a href="https://www.regex101.com/r/HBsst1/1" rel="nofollow noreferrer">https://www.regex101.com/r/HBsst1/1</a></p>
  
  <p>(EDIT) Second set of more complex data - <a href="https://www.regex101.com/r/h7PCv7/1" rel="nofollow noreferrer">https://www.regex101.com/r/h7PCv7/1</a></p>
  
  <p>Using the sample data in that link, I want the regex to identify the two occurrences of <code>theColumnName] VARCHAR(10)</code> and nothing more.</p>
  
  <p>I have 300+ sql scripts which containing create statements for every type of database object: procedures, tables, triggers, indexes, functions -- everything. Because of that, I can't be too strict with my regex. </p>
  
  <p>A stored procedure's file might include text like <code>LEFT(theColumnName, 10)</code> which I want to identify.</p>
  
  <p>A create table statement would be like <code>theColumnName VARCHAR(12)</code>. </p>
  
  <p>So it needs to be very flexible as the number(s) isn't always the same. Sometimes it's 10, sometimes it's 12, sometimes it's 51 -- all kinds of different numbers.</p>
  
  <p>Basically, I'm looking for the regex equivalent of this C# code:</p>
  
  <pre><code>//Get file data
  string[] lines = File.ReadAllLines(filePath);
  
  //Let's assume the first line contains 'theColumnName'
  int theColumnNameIndex = lines[0].IndexOf("theColumnName");
  
  if (theColumnNameIndex &gt;= 0)
  {
      //Get the text proceeding 'theColumnName'
      string temp = lines[0].Remove(0, theColumnNameIndex + "theColumnNameIndex".Length;
  
      //Iterate over our substring
      foreach (char c in temp)
      {
          if (Char.IsDigit(c)) 
              //do a thing
      }
  }
  </code></pre>