ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vihan Pandey" <vihanpan...@gmail.com>
Subject replaceregex issues
Date Mon, 27 Aug 2007 09:59:56 GMT
Hello,
        I have a rather strange issue while replacing strings from a
set of files. My objective is to replace occurences of :

../http://web1.foo.com with http://web1.foo.com
../../http://web1.foo.com with http://web1.foo.com
../../../http://web1.foo.com with http://web1.foo.com

and so on.

The ideal thing of course is to use a regex. i.e (../)* I did :

          <copy todir="${docroot}${release-version}/ct-html">

           <fileset dir="${deployroot}/ct-html/branches/${release-branch}">
                <include name="**/*.*"/>
           </fileset>

          <filterchain>
                <replaceregex pattern="../http" replace="http" flags="gi"/>
          </filterchain>

          </copy>

This works in replacing ../html by html without problems. However when I do :

          <copy todir="${docroot}${release-version}/ct-html">

           <fileset dir="${deployroot}/ct-html/branches/${release-branch}">
                <include name="**/*.*"/>
           </fileset>

          <filterchain>
                <replaceregex pattern="(../)*http" replace="http" flags="gi"/>
          </filterchain>

          </copy>

This fails.

If i do :

          <copy todir="${docroot}${release-version}/ct-html">

           <fileset dir="${deployroot}/ct-html/branches/${release-branch}">
                <include name="**/*.*"/>
           </fileset>

          <filterchain>
                <replaceregex pattern="(../)*http" replace="http" flags="gi"/>
          </filterchain>


          <filterchain>
                <replaceregex pattern="../http" replace="http" flags="gi"/>
          </filterchain>

          </copy>

This replaces the ../html by http but the ../../html ../../../html get
left out. The logical conclusion is my regex is wrong. i tried ^(../)*
but that does not help either.

Any suggestions?

Regards,

- vihan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message