title: How to use Console.ReadLine() in a while statement
body: <p>Im looping a question untill the user puts in the value i want to accept. In this case its a number with a dash and it should be 7 'symbols' long.</p>
  
  <p>My problem is putting the ReadLine inside of the while() statement.</p>
  
  <p>So this is my code:</p>
  
  <pre><code>string cpr = "";
  do
  {
  
  cpr = Console.ReadLine(); //I dont want ReadLine here :/
  
  } while (
  //I want Console.ReadLine() here
  cpr.Length != 7
  &amp;&amp;
  !Regex.IsMatch(cpr, @"^[0-9-]+$")
  &amp;&amp;
  Regex.IsMatch(cpr, @"^[a-z]+$")
  );
  </code></pre>
  
  <p>Putting ReadLine in a while statement is possible i have some other code that works while try parsing an int</p>
  
  <pre><code>do
  {
  //do something here
  } while (!int.TryParse(Console.ReadLine(), out int1));
  </code></pre>