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 9275111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:30:41+00:00 2026-06-18T16:30:41+00:00

Is there a summary=true equivalent in ant replaceregexp tasks like there is in the

  • 0

Is there a summary="true" equivalent in ant replaceregexp tasks like there is in the simple ant replace task?

Here’s my use case. I am replacing an ant replace task with a replaceregexp task, like so:

<replace dir="${dir}" summary="true" value="" token="Some Text">
    <include name="**/*.jsp" />
</replace>

Becomes this:

<replaceregexp byline="true">
    <regexp pattern="Some\s*Text"/>
    <substitution expression=""/>
 <fileset dir="${dir}" includes="**/*.jsp"/>
</replaceregexp>

However, I cannot find a way to have my ant build output the number of replacements which have been made. There is no summary attribute for replaceregexp, and the documentation does not offer any ready suggestions. Is this possible?

  • 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-18T16:30:42+00:00Added an answer on June 18, 2026 at 4:30 pm

    From reading the source of ReplaceRegexp task there ain’t such a feature.
    ant184 => src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java, line 351 :

    protected void doReplace(File f, int options) throws IOException {
            File temp = FILE_UTILS.createTempFile("replace", ".txt", null, true, true);
    
            Reader r = null;
            Writer w = null;
            BufferedWriter bw = null;
    
            try {
                if (encoding == null) {
                    r = new FileReader(f);
                    w = new FileWriter(temp);
                } else {
                    r = new InputStreamReader(new FileInputStream(f), encoding);
                    w = new OutputStreamWriter(new FileOutputStream(temp),
                                               encoding);
                }
    
                BufferedReader br = new BufferedReader(r);
                bw = new BufferedWriter(w);
    
                boolean changes = false;
    
                log("Replacing pattern '" + regex.getPattern(getProject())
                    + "' with '" + subs.getExpression(getProject())
                    + "' in '" + f.getPath() + "'" + (byline ? " by line" : "")
                    + (flags.length() > 0 ? " with flags: '" + flags + "'" : "")
                    + ".", Project.MSG_VERBOSE);
    

    means use loglevel verbose to log the replacements:
    ant -verbose -f yourfile.xml
    or
    ant -v -f yourfile.xml

    Get the ant source distribution file and simply extend the tasks doReplace() method to get your desired output, for example, a counter for the replacements, controlled by a new task attribute ‘summary’ false|true
    You may fill an enhancement report and submit a patch to make it available for other users in the next ant release, more details here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my problem: there's an internal issue tracking system that has a nice summary
I'd like to have a summary in my RadioButton , kind of like there
Summary : is there a way to get the unique lines from a file
Is there any way to hide Summary for CListView without loosing pagination. By summary
There is a note at the end of the atomics package summary that states:
Is there anyway to give text editors summary information in a tooltip for custom
Is there a tool available that can produce an HTML summary list of perl
There's a Rails 3.2.3 web application which doesn't use any database. But in spite
I have a simple function in R that runs summary() via lapply() on many
There are many examples on how to use the Background Audio Agent but very

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.