title: how to check string contain any character other than number in java?
body: <p>I want to check String contain any character or special character other than number.I wrote following code for this</p>
  
  <pre><code>String expression = "[^a-zA-z]";
  Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
  Matcher matcher = pattern.matcher(jTextFieldPurchaseOrder.getText().toString().trim());
  </code></pre>
  
  <p>It is working fine when i am taking value from jTextField and checking my condition. But giving error when checking String from DTO as below</p>
  
  <pre><code>list.get(0).getChalan_trans_id().toString().trim().matches("[^a-zA-z]");
  </code></pre>
  
  <p>Where list is arraylist of DTO.
  I am not getting where am I going wrong?</p>
  
  <p>Thanks</p>