Not a one liner but a two-liner.
This is the technique I use often for displaying paths with <pathconvert> ...
<pathconvert property="p" pathsep="${line.separator}- ">
<fileset dir="." includes="*"/>
</pathconvert>
<property name="listing" value="- ${p}${line.separator}"/>
<echo>${listing}</echo>
The main task just calculates the middle part (${p}) and I have to put
something before and after it.
In your case this is the same:
<property name="list" value="aaa,bbb,ccc"/>
<ac:propertyregex
property="pattern.internal"
input="${list}"
regexp=","
replace="/,**/"
/>
<property name="pattern" value="**/${pattern.internal}/"/>
<echo>Input List : '${list}'</echo>
<echo>Input Pattern: '${pattern}'</echo>
Jan
>-----Ursprüngliche Nachricht-----
>Von: snoofkin [mailto:[EMAIL PROTECTED]
>Gesendet: Mittwoch, 19. November 2008 20:39
>An: [email protected]
>Betreff: Re: AW: How to build an Ant path from a comma-seperated list?
>
>
>Thanks for this idea!
>
>The problem is that the input list is of unknown size, and I
>could not find
>a regexp that will convert all items in this list correctly (I
>bet this can
>be done).
>
>So I came up with the following solution using <for>, <var> and
><propertyregex>:
>
> <var name="dependencies.path" value="" />
> <property name="input.list" value="aaa,bbb,ccc" />
>
> <target name="calculate-dependencies-path"
>description="Converts the
>input.list comma-seperated list to dependencies.path">
> <for param="item" list="${input.list}">
> <sequential>
> <propertyregex property="item.path"
> override="true"
> input="@{item}"
> regexp="(.+)"
> replace="**/\1\/"
> casesensitive="false"/>
> <var name="dependencies.path"
>value="${dependencies.path},${item.path}" />
> </sequential>
> </for>
> <echo>RESULT: ${dependencies.path}</echo>
> </target>
>
>This prints
> RESULT: ,**/aaa/,**/bbb/,**/ccc/
>
>If there is an easier solution using one line regexp I would
>gladly use it,
>as this is somewhat cumbersome.
>
>Thanks!
>Ariel
>--
>View this message in context:
>http://www.nabble.com/How-to-build-an-Ant-path-from-a-comma-sep
>erated-list--tp20572597p20587661.html
>Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]