Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Case sensitive Issue when using Ant Replace task

 
sasank ch
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34378
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic