File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Case sensitive Issue when using Ant Replace task Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Case sensitive Issue when using Ant Replace task" Watch "Case sensitive Issue when using Ant Replace task" New topic
Author

Case sensitive Issue when using Ant Replace task

sasank ch
Greenhorn

Joined: Nov 07, 2007
Posts: 25
Hi!

I want to rename the content of some files (by replacing a string with another) of a specific type (.htm) in a directory including all subdirectories.

Running an "Ant replace task" will do the work:

<target name="rename">
<replace dir="mydir" token="one" value="two">
<include name="**/*.htm"/>
</replace>
</target>

This works fine, however I want the replace to be NON-casesensitive, so that e.g. 'ONE' is also replaced by 'two'.

How do I do that?

Regards,
Sasank
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30752
    
156

Sasank,
The optional task replaceregexp allows you to specify any regular expression including non-case sensitivity. All the optional tasks require an extra jar in the classpath, so check the documentation before calling it.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Case sensitive Issue when using Ant Replace task