Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 28985 invoked from network); 22 Oct 2009 08:40:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Oct 2009 08:40:04 -0000 Received: (qmail 90128 invoked by uid 500); 22 Oct 2009 08:40:03 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 90039 invoked by uid 500); 22 Oct 2009 08:40:03 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 90029 invoked by uid 99); 22 Oct 2009 08:40:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Oct 2009 08:40:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [209.85.216.200] (HELO mail-px0-f200.google.com) (209.85.216.200) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Oct 2009 08:39:54 +0000 Received: by pxi38 with SMTP id 38so590239pxi.10 for ; Thu, 22 Oct 2009 01:39:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.173.2 with SMTP id v2mr1740888rve.214.1256200773167; Thu, 22 Oct 2009 01:39:33 -0700 (PDT) In-Reply-To: <87r5sx2r3h.fsf@v35516.1blu.de> References: <7c55bf80910091025n7eeb2ba4rc688a330c41ddd66@mail.gmail.com> <87pr8tdx5a.fsf@v35516.1blu.de> <7c55bf80910112326p17c8129bi44b433fe36f5de4e@mail.gmail.com> <87tyy09dh4.fsf@v35516.1blu.de> <7c55bf80910160010y355401c7qe0bd2b12b7d76706@mail.gmail.com> <87r5sx2r3h.fsf@v35516.1blu.de> Date: Thu, 22 Oct 2009 10:39:33 +0200 Message-ID: <7c55bf80910220139h5b1366b0wb2214db1d30bc17c@mail.gmail.com> Subject: Re: regexp-type doesn't work as expected/(advertised?) From: Francis GALIEGUE To: Ant Users List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Oct 21, 2009 at 08:33, Stefan Bodewig wrote: [...] > >> I then suggest that the documentation be reviewed to say that the >> regex must match all the filename. > > This is not really true, it doesn't matter whether the match is all of > the file name or only part of it, the key is that the to attribute > provides the target file name and nothing else - in particular not parts > of the source file name that are not matched. > > The documentation currently says > > ,---- > | If the source file name matches the from pattern, the target file name > | will be constructed from the to pattern, using \0 to \9 as > | back-references for the full match (\0) or the matches of the > | subexpressions in parentheses. > `---- > > If you can come up with a clearer way to say what the target file name > is going to be, I'll happily change the wording. > What about: ---- The source filename is matched, in whole or in part, by the "from" pattern. The resulting filename is built using the "to" pattern, which can use backreferences (\0, \1, ...). Warning: unlike what happens with a casual regex substitution operation (f.e. perl's "s//" operator, Java's .replaceAll(), etc), the "to" pattern here is used to construct the _whole_ resulting filename. Therefore, if you want to, for instance, replace the extension of a file with a regex mapper, you should _not_ write: from=3D"\.old$" to=3D".new" but: from=3D"'(.*)\.old$" to=3D"\1.new" (although for this particular case, you'd probably want to use a globmapper instead). ---- --=20 Francis Galiegue ONE2TEAM Ing=C3=A9nieur syst=C3=A8me Mob : +33 (0) 683 877 875 Tel : +33 (0) 178 945 552 fge@one2team.com 40 avenue Raymond Poincar=C3=A9 75116 Paris --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org