title: Stack overflow when using regular expression on java styled comments
body: <p>I'm currently writing a parser in Scala, where I want to have my whitespace defined as matching on both whitespace, and java styled <code>/* */</code> comments. I don't need the <code>//</code> part.</p>
  
  <p>Currently I'm using this definition:</p>
  
  <pre><code>"""((\s+)|(?:/\*(?:[^*]|(?:\*+[^*/]))*\*+/))*""".r
  </code></pre>
  
  <p>I have found most of this definition on this page:
  <a href="http://ostermiller.org/findcomment.html" rel="nofollow">http://ostermiller.org/findcomment.html</a></p>
  
  <p>The problem is that I'm getting a stackoverflow when matching my input. However adjusting my stacksize up to 1 mb fixes the problem. This is unfortunately not a possibility in my production system.
  So what I'm asking for, is if somebody could help me improve my regular expression?</p>
  
  <p>Help would be much appreciated, since I'm only a novice in the Regex world:)</p>
  
  <p>Thanks in advance.</p>
  
  <p>Regards Stefan.</p>