qwazer
qwazer

Reputation: 7521

How to apply regexp on file with pure ANT 1.8

I want to apply regexp find/replace on file with pure ant (for crossplatform)

Is it possible?

Upvotes: 3

Views: 226

Answers (3)

aioobe
aioobe

Reputation: 420951

Yes, it is possible. It is well explained over here: Apache Ant - How to search a and replace regular expressions inside a text.

The article starts by quoting the documentation:

As reported by documentation, Ant provides a task, <ReplaceRegExp>, "for replacing the occurrence of a regular expression with a substitution pattern in a selected file or set of files".

and goes on to describe how you also do it for texts.

Upvotes: 3

ewan.chalmers
ewan.chalmers

Reputation: 16235

All you need is the ReplaceRegExp task.

Upvotes: 2

aviad
aviad

Reputation: 8278

Yes. For example you can create java project that does the regexp magic, then export it to runnable jar and create the batch file or shell script that runs the jar. Finally in ant script you create a new target that runs the executable (batch\shell script)

Upvotes: 0

Related Questions