title: Python regex for matching single line and multi line comments.
body: <p>I'm trying to create a python regex, for PLY, which will match comments of the form </p>
  
  <pre><code>// some comment
  </code></pre>
  
  <p>and </p>
  
  <pre><code>/* comment
     more comment */
  </code></pre>
  
  <p>So I tried </p>
  
  <pre><code>t_COMMENT = r'//.+ | /\*.+\*/'
  </code></pre>
  
  <p>but this doesn't allow for multi line comments and when I try to solve this using the 'dot matches all' options like </p>
  
  <pre><code>t_COMMENT = r'//.+ | (?s) /\*.+\*/'
  </code></pre>
  
  <p>it results in the '//' comment type matching many lines. Also if I try to have two separate regexes like</p>
  
  <pre><code>t_COMMENT = r'//.+' 
  t_COMMENT2 = r'(?s) /\*.+\*/'
  </code></pre>
  
  <p>the '//' comment type still matches multiple lines as though the dot matches all option is selected.</p>
  
  <p>Does anybody know how to solve this?</p>