You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/05/07 19:11:44 UTC
DO NOT REPLY [Bug 51167] New: Support string replacement as part of
property expansion
https://issues.apache.org/bugzilla/show_bug.cgi?id=51167
Bug #: 51167
Summary: Support string replacement as part of property
expansion
Product: Ant
Version: nightly
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: Core
AssignedTo: notifications@ant.apache.org
ReportedBy: kdgregory@yahoo.com
Classification: Unclassified
Created attachment 26968
--> https://issues.apache.org/bugzilla/attachment.cgi?id=26968
Patch for 'replaceAll:' property prefix (against trunk as-of right now)
It is occasionally useful to take one property value and transform it with a
simple string replace. For example, if you have a comma-delimited list of
locales, you might want to generate a fileset from it (this example shows a
BASH-style substitution; see below):
<property name="locales" value="en_US,en_GB,en_CA,fr_FR,fr_CA"/>
<property name="locale.regex" value="${locales/,/|}"/>
<fileset dir="${resource.dir}">
<filename regex="${locale.regex}.txt"/>
</fileset>
It's currently possible to do this using the ant-contrib PropertyRegex task.
However, using that task requires getting the ant-contrib JARfile and adding it
to your classpath.
While I think the BASH-style expansions are cleaner, in keeping with current
practice I suggest adding a "replaceAll:" prefix:
<property name="locale.regex" value="${replaceAll:locales/,/|}"/>
I've attached a patch that implements this, with tests and changes to docs.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 51167] Support string replacement as part of
property expansion
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51167
--- Comment #1 from Matt Benson <mb...@apache.org> 2011-05-08 03:59:41 UTC ---
Seen http://ant.apache.org/antlibs/props/index.html ?
The stringops PropertyEvaluator implements bash style string handling.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.