title: Illegal character range near index 17
body: <p>I'm new to java and i wanted to make an input checker class that when you enter a value (be it int, string or double) it would check if it doesn't contain illegal characters and if it does, return false.</p>
  
  <p>Now, even if it probably sucks and doesn't make much sense, i managed to make a code to do that, the problem is that it gives me a Illegal character range near index 17 exception.</p>
  
  <p>This is the code:</p>
  
  <pre><code>public class InputChecker {
      public InputChecker()
      {
  
      }
  
      public boolean checkString(String string)
      {
          Pattern pattern = Pattern.compile("[1234567890,.-\\!'~#\\@*+%{}&lt;&gt;\\[\\]|\"\\_^]");
          Matcher matcher = pattern.matcher(string);
          return matcher.find();
  
      }
  
      public boolean checkDouble(double theDouble)
      {
          Pattern pattern = Pattern.compile("[,-!'~#@*+%{}&lt;&gt;\\[\\]|\"\\_^]");
          String sDouble = String.valueOf(theDouble);
          Matcher matcher = pattern.matcher(sDouble);
          return matcher.find();
      }
  
      public boolean checkInt(int theInt)
      {
          Pattern pattern = Pattern.compile("[,-!'~#@*+%{}&lt;&gt;\\[\\]|\"\\_^]");
          String sInt = String.valueOf(theInt);
          Matcher matcher = pattern.matcher(sInt);
          return matcher.find();
      }
  
  
  }
  </code></pre>