title: Java Regex Captures Too Much
body: <p>I have reduced my case to the simplest possible example and I still can't get it to work the same in Java and in Python.  Here is my Java code:</p>
  
  <pre><code>    public static void main(String[] args) {
  
      String searchPattern = "gov.noaa.mgdc.mgg.dem:393";
      String regExToApply = ":(.+)$";
  
      Pattern pattern = Pattern.compile(regExToApply);
      Matcher matcher = pattern.matcher(searchPattern);
  
      while (matcher.find()) {
          System.out.println("Match is: \"" + matcher.group() + "\"");
          //Output: Match is: ":393"
      }
  
  
  }
  </code></pre>
  
  <p>In Python, the regEx ":(.+)$" matches just the 393, which is what I want, but in Java, it matches :393.  I have tried specifically listing the : as a non-capturing group, "(?::)(.+)$" and I get the same result.  I've also noticed that removing the parentheses, ":.+$" seem to make no difference.</p>
  
  <p>How do you capture just the 393 in the above string, in Java?  I also need a separate string to capture everything before the colon, not including the colon, as well.  Thanks!</p>