I'm trying to write a regular expression for an Ant task that excludes files in a directory that end with a certain character sequence. For example, I have the following three files:
file01.js
file02.js
file02-copy.js
I want an expression that finds the first two files and ignores the one with "-copy" on the end. I've tried using <include>
's and <excludes>
's like so:
<fileset dir="." includes="js/">
<include name="*.js"/>
<exclude name="*copy*"/>
</fileset>
but obviously because its a JS file, its still included. So I'm trying to use a regular expression to match the files (if anyone has another suggestion please do suggest):
<fileset dir="." includes="js/">
<containsregexp expression="...">
</fileset>
And here lies my problem. I can't find a regEx that does this match for me. I've tried a few things like (\w*)(!-copy).js
but this does nothing. If anyone could help me out I'd be very grateful.
Did I mention that I hate trying to write regEx's?