Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#60 PropertyRegex input should accept property values

open
nobody
None
5
2009-07-20
2009-07-20
grok777
No

PropertyRegex seems like a very useful task, but it really needs to be able to support reading a property value supplied to the input attribute. For example, if I want to get the name of the current directory (not the full path), I should be able to do something like the following.

<property name="current.dir" location="."/>
<property name="current.dir.name" value=""/>

<target name="set-dir-name" description="This SHOULD set the name of the current directory">
<propertyregex
override="true"
property="current.dir.name"
input="${current.dir}"
regexp="/([\w]+)$"
select="\1" />
<echo>${current.dir.name}</echo>
</target>

However, this doesn't do anything, because the input string that it tries to parse is the literal "${current.dir}", not the actual path string. If there is a workaround for doing this, I would like to know the answer.

Discussion

  • grok777
    grok777
    2009-07-20

    This example is probably not a very good use case, because you can accomplish this task with the following:

    <basename property="{current.dir.name}" file="." />

    However, this feature would still be nice to have.