Regex to extract column name and values not working
<p>In java I am trying to extract column names and their values using <code>Regex</code> and <code>Matcher</code> but dont know what I am doing wrong here.</p>

<pre><code>    String sql = "INSERT INTO MyTable (column1, column2, column3, column4, column5 ) VALUES (1, 'Hi', 'A,B', '', null)";
    String pattern = "INSERT INTO.*((\\w)+).*\\((.*)\\).*VALUES.*\\((.*)\\)";

    Pattern r = Pattern.compile(pattern);

    Matcher m = r.matcher(sql);
    if (m.find()) {
        System.out.println("Found value: " + m.group(0));
        System.out.println("Found value: " + m.group(1));
        System.out.println("Found value: " + m.group(2));
    } else {
        System.out.println("NO MATCH");
    }
</code></pre>

<p><strong>Expectation:</strong></p>

<pre><code>Group-1 = column1, column2, column3, column4, column5
Group-2 = 1, 'Hi', 'A,B', '', null
</code></pre>