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:
- read each file of fileset extract specific link contain.
- see if link points existing file.
- if does, apply regex1.
- 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
Post a Comment