This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29233
    
138

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Case sensitive Issue when using Ant Replace task
 
Similar Threads
Ant replace task problem
How to convert java task to junit task to run a java class file
Custom ANT Task not working in <for> loop
append a batch file
"Could not create task of type: echo"