title: Java regex matcher.find fails occasionally
body: <p>I have regexp which parses all names of used freemarker macros in template (for example from <code>&lt;@macroName /&gt;</code> I need only <code>macroName</code>). Templates are usually quite large (round 30 thousand characters). 
  Java code with regex looks like:</p>
  
  <pre><code>Pattern pattern = Pattern.compile(".*?&lt;@(.*?)[ /].*?", 
                                    Pattern.DOTALL | Pattern.UNIX_LINES);
  Matcher matcher = pattern.matcher(inputText);
  while(matcher.find()){
      //... some code
  }
  </code></pre>
  
  <p>But sometimes happens that I get this exception:</p>
  
  <pre><code>java.util.regex.Pattern$Curly.match1(Pattern.java:3814)
  java.util.regex.Pattern$Curly.match(Pattern.java:3763)
  java.util.regex.Pattern$Start.match(Pattern.java:3072)
  java.util.regex.Matcher.search(Matcher.java:1116)
  java.util.regex.Matcher.find(Matcher.java:552)
  ...
  </code></pre>
  
  <p>Does anybody know why it happens or could anybody make me sure if the regexp I'm using is optimized well?
  thank you</p>