This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


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: 30586
    
154

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
 
GeeCON Prague 2014
 
subject: Case sensitive Issue when using Ant Replace task