title: Regex on SQL using Java
body: <p>All I have are SQL Insert statements. I want to do is caputre from the <code>Insert</code> to the end semicolon. Such as:</p>
  
  <p><code>Insert blah INTO blah VAULES(blah);</code></p>
  
  <p>I need to capture all of these.</p>
  
  <p>I am using this <code>^([^;]*)</code> as my regex.</p>
  
  <p>This is my Java code:</p>
  
  <pre><code>private String processFile(String data) {
      StringBuilder retVal = new StringBuilder();
      Pattern pattern = Pattern.compile(REGEX);
      Matcher matcher = pattern.matcher(data);
      while (matcher.find()) {
          String match = matcher.group(1);
          match = match.replaceAll("\n", "");
          retVal.append(match).append(";\n");
      }
      return retVal.toString();
  }
  </code></pre>
  
  <p>But it seems to only capture the first occurrence. How can I capture all of them?</p>