> And this is hardly surprising as I was confounding shell patterns and
> regular expressions. The following, while not working, is at least a
> suitable regular expression:
>
> <regexpmapper handledirsep="1"
> from="${source.dir}/[-_a-zA-Z0-9]+/lib/(.*)"
> to="\1" />
But of course, just for the fun of it, I had introduced some other
issues as well.
First, in a regression from what I had already learnt, I resupplied
the ${source.dir} to the mapper. However, ${source.dir} appears to be
the context directory for the copy task, so the character string
representing that path segment is not present in the paths to be
copied.
Second, the @handledirsep was happily switched off because "1" appears
to mean "no", and not "yes" as my intuition told me.
Third, while <regexpmapper> without @handledirsep appears to always copy
the files even when not necessary, <regexpmapper> *with* that attribute
only copies them when necessary, which is something to watch out for
when testing what works and what doesn't.
Here's working code:
<project default="copy">
<property name="source.dir" location="src"/>
<property name="target.dir" location="lib"/>
<target name="copy">
<copy todir="${target.dir}">
<fileset dir="${source.dir}">
<include name="*/lib/**/*.*"/>
<exclude name="**/urmel.*"/>
</fileset>
<regexpmapper handledirsep="yes"
from="^[-_a-zA-Z0-9]+/lib/(.*)"
to="\1" />
</copy>
</target>
</project>
--
Michael Ludwig