regex - Read content of a set of file and check existence of a file in Ant -


i'm new ant , can't quite figure out how following (if possible @ all): have basic code:

<copy todir="${mydir}">     <fileset dir="${mydir2}" includes="**/*.html" />         <filterchain>             <replaceregex pattern="bla" replace="pla"/> <!-- regex1 -->             <replaceregex pattern="doh" replace="dah"/> <!-- regex2 -->         <filterchain> </copy> 

in folder recursed fileset task, have bunch of html files, contain link existing file, contain link non-existing file.

now i'm trying to:

  1. read each file of fileset extract specific link contain.
  2. see if link points existing file.
  3. if does, apply regex1.
  4. if doesn't, apply regex2 remove dead link.

so there's bit of everything: conditions, retrieval of data files ant use in other tasks, , seems impossible do!

thanks help.

use filterchain tokenfilter replaceregex, f.e. :

<copy todir="${mydir}">  <fileset dir="${mydir2}" includes="**/*.html"/>   <filterchain>    <tokenfilter>     <!-- regex 1 -->     <replaceregex pattern="hello" replace="world" flags="gi"/>     <!-- regex 2 -->     <replaceregex pattern="doh" replace="dah"/>    </tokenfilter>   </filterchain> </copy> 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -