title: Unclosed character class in Java semver regex
body: <p>Java 8 here. I'm being passed a <code>String</code> and I need to tell if it matches our interval rendition of a semantically-versioned JAR file or not, which:</p>
  
  <ul>
  <li>Starts with any alphanumeric string (hyphens also allowed here)</li>
  <li>Followed by a hypen (<code>-</code>)</li>
  <li>Followed by normal semver:
  
  <ul>
  <li>Major release number; then</li>
  <li>Minor release number; then</li>
  <li>Patch number</li>
  </ul></li>
  <li>Ending with a suffix of <code>.jar</code></li>
  </ul>
  
  <p>Examples of valid file names:</p>
  
  <ul>
  <li><code>some-lib-1.4.17.jar</code></li>
  <li><code>someLib-1.4.17.jar</code></li>
  <li><code>somelib-0.12.0.jar</code></li>
  </ul>
  
  <p>My best attempt thus far:</p>
  
  <pre><code>public boolean isValidJarName(String jarName) {
      String fileRegex = "^([a-zA-Z\\-))((\\d+)\\.(\\d+)\\.(\\d+)).jar";
      Pattern filePattern = Pattern.compile(fileRegex);
      Matcher matcher = filePattern.matcher(jarName);
  
      return matcher.matches();
  }
  </code></pre>
  
  <p>However this gives me a compiler error: <code>Unclosed character class</code>. So something is wrong with my regex syntactically, but then I'm not even sure if its set up correctly to give me what I'm looking for. Any ideas where I'm going awry?</p>