Do it with javascript.  Forget Perl.

<project name="test_project" default="test" basedir=".">
    <property name="test-prop" value="server1-db1"/>

    <target name="test">
        <script language="javascript"> <![CDATA[

            temp = test_project.getProperty("test-prop");
            index = temp.indexOf("-");
            test_project.setProperty("extractedFromTest",
temp.substring(index + 1, temp.length()));

            ]]>
        </script>
        <echo message="${extractedFromTest}" />
    </target>

</project>


----- Original Message -----
From: "Anthony Rodriguez" <[EMAIL PROTECTED]>

> This is for anyone out there who has run the <script> task using Perl.
I am
> running ant1.4 release and I need to do the following.
>
> Let's say I have the following property:
>
> <property name="test" value="server1-db1"/>
>
> Now I want to extract everything after the "-" in the ${test} property
and
> make that value a new property.  In this case the new property would
be:
>
> <property name="extractedFromTest" value="db1"/>
>
> I am fairly good with Perl but I don't know how to use the <script>
task
> properly with it.  I understand that ant1.5 may have tasks to suit my
need
> here but I am looking for a way to do it using ant1.4.
>
> Anthony Rodriguez
> WeddingChannel.com
> 213 599-4419
> [EMAIL PROTECTED]
>
> Need to buy a wedding gift?
> Visit http://www.weddingchannel.com
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to