title: Removing whitespaces at the beginning of the string with Regex gives null Java
body: <p>I would like to get groups from a string that is loaded from txt file. This file looks something like this (notice the space at the beginning of file):</p>
  <pre><code>as431431af,87546,3214| 5a341fafaf,3365,54465      | 6adrT43   ,  5678  ,            5655
  </code></pre>
  <p>First part of string until first comma can be digits and letter, second part of string are only digits and third are also only digits. After | its all repeating.</p>
  <p>First, I load txt file into string :<code>String readFile3 = readFromTxtFile(&quot;/resources/file.txt&quot;);</code></p>
  <p>Then I remove all whitespaces with regex :</p>
  <pre><code>String no_whitespace = readFile3.replaceAll(&quot;\\s+&quot;, &quot;&quot;);
  </code></pre>
  <p>After that i try to get groups :</p>
  <pre><code>Pattern p = Pattern.compile(&quot;[a-zA-Z0-9]*,\\d*,\\d*&quot;, Pattern.MULTILINE);
  Matcher m = p.matcher(ue_No_whitespace);
  int lastMatchPos = 0;
  while (m.find()) {
      System.out.println(m.group());
      lastMatchPos = m.end();
  }
  if (lastMatchPos != ue_No_whitespace.length())
     System.out.println(&quot;Invalid string!&quot;);
  </code></pre>
  <p>Now I would like, for each group remove &quot;,&quot; and add every value to its variable, but I am getting this groups : (notice this NULL)</p>
  <pre><code>nullas431431af,87546,3214
  5a341fafaf,3365,54465
  6adrT43,5678,5655
  </code></pre>
  <p>What am i doing wrong? Even when i physicaly remove space from the beginning of the txt file , same result occurs.
  Is there any easier way to get groups in this string with regex and add each string part, before &quot;,&quot; , to its variable?</p>