[
https://issues.apache.org/jira/browse/AMBARI-23745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jonathan Hurley resolved AMBARI-23745.
--------------------------------------
Resolution: Fixed
> Replace Multiple Matches Using Regex on Upgrades
> ------------------------------------------------
>
> Key: AMBARI-23745
> URL: https://issues.apache.org/jira/browse/AMBARI-23745
> Project: Ambari
> Issue Type: Task
> Affects Versions: 2.7.0
> Reporter: Jonathan Hurley
> Assignee: Jonathan Hurley
> Priority: Critical
> Labels: pull-request-available
> Fix For: 2.7.0
>
> Time Spent: 2h
> Remaining Estimate: 0h
>
> When upgrading from one stack to another, the {{regex-replace}} key can be
> used to find and replace a block of text which matches a given regular
> expression. This works by finding the literal string matching the regex and
> turning this into a regular find/replace.
> For example:
> {code}
> <regex-replace find="\d-foo-\d" replace="REPLACED"/>
> {code}
> on
> {code}
> 1-foo-1
> 2-foo-2
> 3-foo-3
> {code}
> Would produce:
> {code}
> REPLACED
> 2-foo-2
> 3-foo-3
> {code}
> In order to replace all of the possible matches, we can extend the XSD of
> {{RegexReplace}} to create multiple literal {{Replace}} instances for every
> match.
> {code}
> <regex-replace find="\d-foo-\d" replace="" match-all="true"/>
> {code}
> Would produce:
> {code}
> REPLACED
> REPLACED
> REPLACED
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)