title: Using ant scriptdef regex, getting javascript.EvaluatorException
body: <p>Environment : ANT 1.9.4, using scriptdef javascript to retrieve version number from a filename.</p>
  
  <p>In a selected directory, find the file names with .jar extension, get all the file names, loop through each file name to retrieve a particular string and extract the version number from that string. I used scriptdef javascript to achieve this. Code is copied below. </p>
  
  <p>File name format is 
                "GeneralService_V1.2.jar"  &amp; 
                "GeneralService_V10.6_SSL.jar".  </p>
  
  <p>Regex expression used to retrieve <em>Vx.x</em> is "<em>\V\[0-9]+\.\[0-9]+\</em>" ( this is only for the second filename format).</p>
  
  <p>I'm getting error -  javax.script.ScriptException: sun.org.mozilla.javascript.EvaluatorException: missing ; before statement (#11) in  at line number 11</p>
  
  <p>Its failing at pattern line, am I using correct Pattern statement or the regex expression is wrong? </p>
  
  <pre><code>    &lt;scriptdef name="jarFiles" language="javascript"&gt; 
      &lt;element name="fileset" type="fileset"/&gt;            
          &lt;![CDATA[           
              importClass(java.io.File);
              importClass(org.apache.commons.io.FilenameUtils);
              importClass(java.util.regex.Pattern);
              importClass(java.lang.System);
              filesets = elements.get("fileset");
                for (i = 0; i &lt; filesets.size(); ++i) {
                  fileset = filesets.get(i);                  
                  Pattern pat = Pattern.compile("_\\V\\[0-9]+\\.\\[0-9]+\\_");
                  Matcher matcher = pat.match(fileset);
                  if (matcher.find()) {
                      System.out.println(matcher.group(0)); //prints _Vx.x_
                      String currJarVersion = matcher.group(0);
                  } else {
                      System.out.println("Match not found");
                  }                
          ]]&gt;
      &lt;/scriptdef&gt; 
      &lt;jarFiles&gt;
          &lt;fileset id="jars" dir="${svn.jar.path}"&gt;
                &lt;include name="**/*.jar" /&gt;
          &lt;/fileset&gt;  
      &lt;/jarFiles&gt;                 
  
      &lt;propertyregex property="currJarVersion"                       
                     regexp="_V"
                     replace=""
                     global="true" /&gt; 
      &lt;echo message="${currJarVersion}"/&gt; 
  </code></pre>