title: Java Regex,Empty String be matched
body: <p>I wrote a regex in Java to match sentences containing some string like this:</p>
  
  <pre><code>String regex = "((^|([.!?:] ))" + "[^!.?:]*?" + queryStr + ".*?" + "([!.?])|$)+?";
  </code></pre>
  
  <p>Then I use the regex to match my String, see below:</p>
  
  <pre><code>Pattern pattern = Pattern.compile(regex);
  String content = "Hello World!!!";
  Matcher match = pattern.matcher(content);
  int index = 0;
  while(match.find(index))
  {
     index = match.end() -1;
     System.out.println(match.group());
  }
  </code></pre>
  
  <p>But the loop never ends, I suspect, because the regex matches empty string. Apparently, my regex includes the String queryStr. So, I am confused with this. Can anyone help me to slove this?</p>