title: Regex to match only letters and numbers
body: <p>Can you help with this code?</p>
  
  <p>It seems easy, but always fails.</p>
  
  <pre><code>@Test
  public void normalizeString(){
      StringBuilder ret =  new StringBuilder();
      //Matcher matches = Pattern.compile( "([A-Z0-9])" ).matcher("P-12345678-P");
      Matcher matches = Pattern.compile( "([\\w])" ).matcher("P-12345678-P");
      for (int i = 1; i &lt; matches.groupCount(); i++)
          ret.append(matches.group(i));
  
      assertEquals("P12345678P", ret.toString());
  }
  </code></pre>