Ok, I had a look into the source of <containsregexp>
org.apache.tools.ant.types.selectors.ContainsRegexpSelector.
It checks the 'content' of the file ...
- directories are always selected
- files are selected its content matches the regexp expression
I'll update the manual to make this more clear.
After that I think that you want to select files which 'names' match the regexp.
The <filename> selector supports simple pattern matching like '*' but no real
regexps.
I havent found a builtin one, but with BSF+Java4 or Java6 you could use a
scripted selector.
<project>
<property name="searchRegexp" value="six.*"/>
<pathconvert property="selected" pathsep="${line.separator}">
<fileset dir=".">
<scriptselector language="javascript" setbeans="true">
self.setSelected( filename.match(searchRegexp) != null );
</scriptselector>
</fileset>
</pathconvert>
<echo>Selected files for ${search.regexp}</echo>
<echo>${selected}</echo>
</project>
Jan
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 20. Mai 2008 17:47
> An: Ant Users List
> Betreff: Re: AW: generate file list with parameterized regexp
>
> Yes I have tried "containsregexp". As far as I could tell,
> there is no way
> to parameterize the regexp within the fileset, so that does not work.
>
> [EMAIL PROTECTED] writes:
>
> > Have you tried
> http://ant.apache.org/manual/CoreTypes/selectors.html#regexpselect ?
> > Then you got the 'problem' of correctly masking the regexp.
> >
> > Jan
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >> Gesendet: Dienstag, 20. Mai 2008 07:57
> >> An: [email protected]
> >> Betreff: generate file list with parameterized regexp
> >>
> >>
> >> I am ant-challenged today: I want to find a set of files in a
> >> tree matching
> >> a given regular expression. The catch is that the regexp is
> >> not constant,
> >> but is a function of the file name. I have tried permutations of
> >> pathconvert, for loops, and loadfile, filterchain, and
> >> linecontainsregexp,
> >> stumbling when I could not change the property loaded from
> >> loadfile after
> >> its initial value. Any suggestions?
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]