title: scanf regex - C
body: <p>I needed to read a string until the following sequence is written: \nx\n :</p>
  
  <pre><code>(.....)\n
  x\n
  </code></pre>
  
  <p>\n is the new line character and (.....) can be any characters that may include other \n characters.</p>
  
  <p>scanf allows regular expressions as far as I know, but i can't make it to read a string untill this pattern. Can you help me with the scanf format string? </p>
  
  <hr>
  
  <p>I was trying something like:</p>
  
  <pre><code>char input[50000];
  scanf(" %[^(\nx\n)]", input);
  </code></pre>
  
  <p>but it doesn't work.</p>