[ 
https://issues.apache.org/jira/browse/AMBARI-23745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jonathan Hurley updated AMBARI-23745:
-------------------------------------
    Description: 
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}

  was:
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=""/>
{code}

on

{code}
1-foo-1
2-foo-2
3-foo-3
{code}

Would produce:
{code}
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.



> Allow Multiple Regex Replacements 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
>             Fix For: 2.7.0
>
>
> 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)

Reply via email to