ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniels, Doug" <Doug.Dani...@GDC4S.Com>
Subject Retrieving a list of directory names from fileset without the ful ly qualified path
Date Thu, 01 Apr 2004 16:54:05 GMT
Hi everyone, I'm not sure this is the place to ask but I'm looking for a
regular expression that will convert an argument string that contains a list
of directories with fully qualified paths and I want to strip this down to
just the names of the directories without the rest of the path:

for example my string looks like this:

"-s /a/b/c -s /d/e/f" and I want to convert it to:
"-s c -s f"

Here is my test code, I'm using the ant-contrib library for the
<propertyregex>, so point the libpath
property to where your ant-contrib jar is:

<project name="test" default="main">

<target name="main">

<taskdef resource="net/sf/antcontrib/">
    <pathelement location="${libpath}/ant-contrib-0.3.jar"/>

   <dirset id="homeDirs" dir="${user.home}" includes="*"/>

   <pathconvert pathsep=" -s " refid="homeDirs" property="arguments"/>

   <propertyregex property="arguments" global="true" override="true"
      defaultValue="failed" />
   <echo>ARGUMENTS: ${arguments}</echo>



~ Doug Daniels

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message