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: [email protected]
ReportedBy: [email protected]
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.