Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8519487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:15:45+00:00 2026-06-11T06:15:45+00:00

I have a ant parameter with list of values as below. releases=release1,release2 I use

  • 0

I have a ant parameter with list of values as below.

releases=release1,release2

I use the below for loop to process the values.

<for list="${releases}" param="release">
  <sequential>
    <echo>Processing @{release}</echo>
  </sequential>
<for>

I want to do something like, I want to echo the below statement only when the @{release}=release2

<echo>Processing last release</echo>

I am not quite sure how to get the index of the list items or if it is even possible.

Thanks in advance,
Balaji

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:15:47+00:00Added an answer on June 11, 2026 at 6:15 am

    That’s all? And, you’re using Ant-Contrib tasks already. Take a look at the PropertyRegEx task. That’s the Ant-Contrib task that will do exactly what you want:

    <propertyregex property="last.release"
         input="${releases}"
         regexp=".*,(.*)"
         select="\1"/>
    

    This will set ${last.release} to the last release in your string.

    Be careful of strings that are null or don’t match your regular expression! You can use the Ant-Contrib if task to test for that:

    <propertyregex property="last.release"
         input="${releases}"
         regexp=".*,(.*)"
         select="\1"/>
    <if>
        <isset property="last.release"/>
        <then>
            <echo>The last release is ${last.release}</echo>
        </then>
        <else>
            <fail>Oops! Something didn't work...</fail>
        </else>
    </if>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ant target where I successfully use a sshexec-task to install a
I use maven release plugin. In my pom exists and Ant task that automatically
I have Ant configured to use the AnsiColorLogger. In Mac OS 10.5, everything was
I have an ant task which should compare two values for equality. If the
I have an ANT configuration file which is becoming complicated, and now I'm stuck
I have an ant target that echo's the content of an eclipse .project file,
I have an ant build script that needs to pull files down from a
I have an ant script with the following header: <project name=Simple ActiveJDBC Example default=clean
I have an Ant copy task (defined in a Maven script invoked by a
We currently have an ant task that contains something similar to the following: <filelist

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.