title: Greedy vs Non-Greedy Pattern Matching in Java
body: <p>What is the regular expression to capture the following groups in the given string using JAVA:</p>
  
  <pre><code>hey,soul,345
  </code></pre>
  
  <p>with the constraint that the first word may include a comma as well. I have the following regex:</p>
  
  <pre><code>(.*),(.*),(.*)
  </code></pre>
  
  <p>but I essentially want to match the last 3 commas only.</p>