开发者

How to apply regexp on file with pure ANT 1.8

I want to appl开发者_StackOverflow中文版y regexp find/replace on file with pure ant (for crossplatform)

Is it possible?


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.


All you need is the ReplaceRegExp task.


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜