help with propertyregex !

Help
Walt
2005-01-05
2013-04-24
  • Walt
    Walt
    2005-01-05

    Hi,

        I try to use the propertyregexp and I got the example that is on the propertyregexp documentation page :

            <propertyregex property="pack.name"
                      input="package.ABC.name"
                      regexp="(package)\.[^\.]*\.(name)"
                      replace="\1.DEF.\2"
                      casesensitive="false" />

    But when I run it, I got the error :

       No supported regular expression matcher found

    Do someone known what is wrong ?

    Thanks

     
    • Walt
      Walt
      2005-01-06

      Hi,

         I post the whole build.xml that does not mark.

      <project default="build" name="test">
          <!-- Include this ant-contrib package -->
          <property name="antcontrib" value="D:\Work\Tools\ant-contrib1.0b1\lib\ant-contrib-1.0b1.jar" />
          <taskdef resource="net/sf/antcontrib/antcontrib.properties">
              <classpath>
                  <pathelement location="${antcontrib}" />
              </classpath>
          </taskdef>

          <target name="build">
              <propertyregex property="pack.name"
                    input="package.ABC.name"
                    regexp="package\.([^\.]*)\.name"
                    select="\1"
                    casesensitive="false" />
                   
              <echo message="${pack.name}">@@</echo>
          </target>
      </project>

      If anybody have an idea of the problem ...please help me !

       
    • My initial guess is that the necessary jar
      files/settings for regex aren't set.

      What version of java are you using? What version of ant?  (At the command line, run java -version and ant -version.)

      I know that if you're using 1.5.3, you need to put <ANT DIR>/lib/optional.jar.

      I also got this from the ANT documentation:
      he regexp mapper needs a supporting library and an implementation of org.apache.tools.ant.util.regexp.RegexpMatcher that hides the specifics of the library. Ant comes with implementations for the java.util.regex package of JDK 1.4, jakarta-regexp and jakarta-ORO. If you compile from sources and plan to use one of them, make sure the libraries are in your CLASSPATH. For information about using gnu.regexp or gnu.rex with Ant, see this article.

      Hope this helps,
      Athas

       
    • ... Put optional.jar in your classpath ...