Renato Shumi
Renato Shumi

Reputation: 318

Ant regex to find two kind of files

I am using regex in a ant file to identify two kind of files:

. Files that finish with *.bin.zip . Files that finish with *[0-9].zip

I am using the or (|) condition to merge it but it is not working:

<fileset dir="${project.folder}/target/build">
   <filename regex=".*[0-9].zip | .*bin.zip"/>
</fileset>

Someone can help me?

Upvotes: 0

Views: 108

Answers (2)

jotik
jotik

Reputation: 17900

Try without the spaces:

<filename regex=".*[0-9].zip|.*.bin.zip"/>

Or better:

<filename regex=".*([0-9]|.bin).zip"/>

Upvotes: 3

M A
M A

Reputation: 72844

Remove the spaces in your regex; they are being counted in the pattern.

<fileset dir="${project.folder}/target/build">
   <filename regex=".*[0-9].zip|.*bin.zip"/>
</fileset>

Upvotes: 2

Related Questions