title: Java RegEx - special character til end of string
body: <p>Given rules for Strings are</p>
  
  <pre><code>[Random Nr of Letters]##[Random Nr of Letters]#[Random Nr of Letters]##########
  </code></pre>
  
  <p>String Length has to be 35</p>
  
  <p>My String e.g. looks like</p>
  
  <pre><code>TEST##TESTING#TEST#################
  </code></pre>
  
  <p>My problem is that I can't detect wrong formats like</p>
  
  <pre><code>TEST##TESTING#TEST##A##############
  </code></pre>
  
  <p>My method is:</p>
  
  <pre><code>private static boolean test(String test_line) {
      String test = "[A-Z]{1,}##[A-Z]{1,}#[A-Z]{1,}#{1,}";
      Pattern test_pattern = Pattern.compile(test);
      Matcher matcher = test_pattern.matcher(test_line);
      return matcher.find();
  }
  </code></pre>
  
  <p>Is there an easy method with RegEx (I have to use it) like "end this String with # and don't allow other characters".</p>
  
  <p>Another problem:
  How can I assure that my test won't allow other characters than A-Z 0-9 and #? Something like:</p>
  
  <pre><code>    String test = "([^A-Z][^0-9][#])";
      Pattern test_pattern = Pattern.compile(test);
      Matcher matcher = test_pattern.matcher(test_line);
      return matcher.find();
  </code></pre>
  
  <p>(with negotiating)</p>
  
  <p>Thanks for the help :)</p>