ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Inger <>
Subject Re: AW: search for words in a file
Date Thu, 18 Oct 2001 14:39:44 GMT
a will back, i submitted a ReplaceRegExp task for
consideration into the optional package.  i'm not
sure whatever became of it, but the underlying data
types might be very useful to you in your search

// There may be typos in this code, as i just
// whipped it up in this e-mail.


public class MyTask extends Task
  public void execute()
   throws BuildException
    // factory class instantiates the apprioriate
    // implementation of the Regexp interface
    RegexpFactory factory = new RegexpFactory();
    Regexp re = factory.newRegexp();
    if (re.matches(input))
      // do something

you can use one of 3 regular expression packages.
The value of the system property "ant.regexp.regexpimpl"
determines which package to use:

Jakarta-Oro (default) :



I have attached this task, and the underlying classes
you would need to use in your task, should you go that

On Thu, 2001-10-18 at 10:11, wrote:
> Well,
> What I propose is really not for beginners. Make your own task (take the
> documented example and make a simple search routine. You
> have to set up three main attributes: The root path, the specific word and a
> text file to save the results in. OroMatcher would be easier to use. Try it!
> In the patternset you can add includesFile to include the file in a fileset.
> Have a look at the attachment to make your own task...
> It's used like this:
> SearchTask d:\root d:\root\matches.txt someIdentifier 
> Thomas Kerle
> Informatikdienste
> -----Urspr√ľngliche Nachricht-----
> Von: [] 
> Gesendet: Mittwoch, 17. Oktober 2001 15:31
> An:
> Betreff: search for words in a file
> Hi guys,
> I am new at Ant, and was curious if there is any task to search for a
> specific word i.e 'main' in a file.
> If the word doesn't exist then include it in a fileset, otherwise ignore
> it.
> Thank you
> -Christine
Matt Inger (
Sedona Corporation
455 S. Gulph Road, Suite 300
King of Prussia, PA 19406
(484) 679-2213
"Self-respect - the secure feeling that no one,
 as yet, is suspicious." -H.L. Mencken 

View raw message