Rod, I've seen it. As I said shortly after your first post, I want to address the older bug fix and enhancement patches before going onto new functionality. So it may take a little time. Someone else may pick it up otherwise I will get to it eventually. I usually search for [PATCH] when looking for things that still need doing so I am happy to use that even for new code. In any case, I try not to ignore things which are not in the right format.
If things don't happen, please give us a gentle reminder. Conor -- Conor MacNeill [EMAIL PROTECTED] Cortex eBusiness http://www.cortexebusiness.com.au -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 5 January 2001 10:06 To: [EMAIL PROTECTED] Subject: [CONTRIB] Regular Expression Replace Task I sent a version of this out on Monday, my apologies if its already in some committer's queue, but I was afraid it might have been missed in the holiday rush and absent any sort of [PATCH] style subject-line. (By the way, what's the convention for marking a wholly new contribution? I've seen [PATCH] and [CONTRIB] on a couple of lists, but I wasn't able to find a canonical form in the site documentation. Is it a [PATCH] even if it doesn't change any currently committed files?) Here's a new task that performs a regular expression substitution inline on a file or a set of files. The substitution pattern can contain references to subexpressions within the find pattern, which makes it possible to use fragments of the original text in the new text. The syntax and implementation borrows from the replace task, for example, given the following file: public class BuildInfo { public static final String TIMESTAMP = /*[[TIMESTAMP[[*/"[EMAIL PROTECTED]"/*]]TIMESTAMP]]*/; public static final String VERSION = /*[[VERSION[[*/"3.1.4"/*]]VERSION]]*/; public static void main(String[] args) { System.out.println("Compiled on:\t" + TIMESTAMP); System.out.println("Version:\t" + VERSION); } } The tasks: <rereplace file="BuildInfo.java" find="/\*\[\[TIMESTAMP\[\[\*/.*/\*\]\]TIMESTAMP\]\]\*/" replaceWith="/*[[TIMESTAMP[[*/"[EMAIL PROTECTED]"/*]]TIMESTAMP]] */"/> <rereplace file="BuildInfo.java" find="/\*\[\[VERSION\[\[\*/.*/\*\]\]VERSION\]\]\*/" replaceWith="/*[[VERSION[[*/"${version}"/*]]VERSION]]*/"/> will update BuildInfo.java file with the associated properties. This is a superset of <replace> functionality, and I found it more useful than using filter tokens, since the source file is compile-able as is. (This also helps to work around limitations in ClearCase, which doesn't support RCS-style $Id, etc.) This implementation relies upon the jakarta-oro regular expression package (see http://jakarta.apache.org/oro), although it is relatively simply to modify the code to support alternative regular expression packages. Documentation and some examples can be found in the attached archive. I've seen a few requests for this functionality on the list, and I've found this task to be useful, so I thought others might also. In theory, this could replace the replace task altogether, but I've packaged it as optional since it depends upon the oro library. (The archive also includes a support class that implements an arbitrary nested element containing text, which may be independently useful.) Enjoy, Rod Waldhoff <[EMAIL PROTECTED]>