title: Java code regex not working
body: <p>I am trying to add a validation utility to a program I have already created. This utility will analyze a file to ensure it meets proper parameters. I have finished the analysis for the first line and am running into a problem regarding whitespaces. The file that I am using for testing includes this line: </p>
  
  <pre><code>1459875655257 05112345678945612345678941EMMAM                  BANK OF AMERICA, NA    BAC     
  </code></pre>
  
  <p>The block of code that tests this line and is generating the problem is as follows: </p>
  
  <pre><code>  if(immediateDestName.isEmpty()){
      JOptionPane.showMessageDialog(null, 
        "ERROR: File header immediate destination name is missing!");
    } else {
      if((sCurrentLine.substring(40,63)).matches("A-Za-z0-9 ]+")){
      }else{
        JOptionPane.showMessageDialog(null, 
           "ERROR: File header immediate destination name is invalid: "
           +sCurrentLine.substring(40,63));
      }
    }
  </code></pre>
  
  <p>When I run the validation utility it pops open that JOptionPane, suggesting that the name is invalid. Just FYI the actual substring is EMMAM followed by a bunch of whitespaces (hence the problem). </p>
  
  <p>Can someone please help me figure out why my program is flagging this alert even though from all I can see the substring matches the regex? </p>