New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added number of matches to replace parameter #79094
Conversation
Signed-off-by: Shivam Durgbuns <shivamdurgbuns@gmail.com>
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Shivam Durgbuns <shivamdurgbuns@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm, could you add a couple of integration tests to ensure we do not regress?
Sure will do that @bcoca |
@@ -0,0 +1,2 @@ | |||
minor_changes: | |||
- added new `numberofmatches` paramter to replace function to replace the first n number of occurances (https://github.com/ansible/ansible/issues/78866) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivamdurgbuns typo
after: "<Location /2>" | ||
regexp: 'Require\s+[^\n]+$' | ||
replace: 'Require ip {{ ips | join(" ") }}' | ||
numberofmatches: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using count
to reflect the actual keyword parameter that you are using.
@shivamdurgbuns consider adding these tests:
|
Closing for inactivity |
Signed-off-by: Shivam Durgbuns shivamdurgbuns@gmail.com
SUMMARY
Added
numberofmatches
parameter to replace functionality to replace the first n number of matches during a replace function, the default is set to 0 i.e all the occurrences will be replaced.Fixes: #78866
ISSUE TYPE
COMPONENT NAME
replace