title: Regex for Maven artifact-like paths
body: <p>I'm trying to come up with a regex for the following case...</p>
  
  <p>We're doing a cleanup of some Maven artifacts which were incorrectly deployed to a repository. The Maven format for naming artifacts is like this:</p>
  
  <pre><code>${groupId}/${artifactId}/${version}/${artifactId}-${version}-${classifier}.jar
  </code></pre>
  
  <p>Where:</p>
  
  <ul>
  <li><code>groupId</code> : The ID of the group (common package name) for the artifact, for example <code>com.foo</code> (the dots get expanded to wildcards by Maven)</li>
  <li><code>artifactId</code> : The ID of the artifact, for example <code>bar</code></li>
  <li><code>version</code> : The version, for example <code>1.2.3</code></li>
  <li><code>classifier</code> : This is an optional property which allows you to specify a sub-artifact, for example <code>sources</code>, <code>javadocs</code>, <code>jdk14</code>, etc... This may, or may not exist.</li>
  </ul>
  
  <p>Here are some valid paths:</p>
  
  <pre><code>com/foo/bar/1.2.3/bar-1.2.3.jar
  com/foo/bar/1.2.3/bar-1.2.3.pom
  com/foo/blah/1.2.3/blah-1.2.3.jar
  com/foo/blah/1.2.3/blah-1.2.3.pom
  com/foo/blah/1.2.3/blah-1.2.3-javadocs.jar
  com/foo/blah/1.2.3/blah-1.2.3-sources.jar
  com/foo/blah/1.2.3-SNAPSHOT/blah-1.2.3-SNAPSHOT.jar
  com/foo/blah/1.2.3-SNAPSHOT/blah-1.2.3-SNAPSHOT.pom
  com/foo/blah/1.2.3-SNAPSHOT/blah-1.2.3-SNAPSHOT-javadocs.jar
  com/foo/blah/1.2.3-SNAPSHOT/blah-1.2.3-SNAPSHOT-sources.jar
  com/foo/myapp/user-management/1.2.3/user-management-1.2.3.jar
  com/foo/myapp/user-management/1.2.3/user-management-1.2.3.pom
  </code></pre>
  
  <p>I need to find any matching invalid paths using <code>grep</code> (as I have the massive list of files in the repository) for the following:</p>
  
  <pre><code>com/foo/bar/1.2.3/blah.jar        {notice how:
                                     a) the artifactId is not part of the file name;
                                     b) there is no specified version
  
                                     In this case com/foo would be the groupId,
                                     but blah is not the artifactId
                                     and there is no version
                                    }
  blah/1.zip                        {notice how there is no:
                                     a) artifactId
                                     b) version component of the path
                                    }
  </code></pre>
  
  <p>The above illustrates cases which don't follow the Maven format explained in the beginning.</p>