title: REGEX to remove multiline comments
body: <p>i've searched quite a lot and the best i created till now to match multiline c comments is:</p>
  
  <pre><code>\/\*(.|\n)*\*\/
  </code></pre>
  
  <p>but for a text like this:</p>
  
  <pre><code>1. Not a comment
  2.
  3.Ooops Not a comment /**** A multiline comment **/  Ooops Not a comment
  4. Ooops Not a comment /**** A multiline comment **\/
  5.  ******  Ooops Not a comment
  6.  ***/
  7.// A another comment
  8.Another not a comment
  9.
  10. "/*Again not a comment*/"
  11.// A line comment at the end of file
  
  The outcome looks like this: 
  
  1. Not a comment
  2.
  3.Ooops Not a comment "
  11.// A line comment at the end of file
  </code></pre>
  
  <p>Can someone explain my mistake and give me the correct one? thank you!</p>
  
  <p>Full code:
  [spoiler]</p>
  
  <pre><code>%option noyywrap
  %{
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  FILE *fout;
  %}
  
  %%
  \/\*(.|\n)*?\*\/
  %%
  void main( int argc, char ** argv)
  {
      if ( argc &lt; 3 )
      {
          printf("\nError!!! Missing Command line arguments");
          printf("\nUsage exe &lt;inputfile&gt; &lt;outputfile&gt;");
          exit(1);
      }
      else
      {
          fout = fopen(argv[2],"w");
          yyout = fout;
          yyin = fopen(argv[1],"r");
          yylex();
      }
      system("pause");
  }
  </code></pre>
  
  <p>[/spoiler]</p>