-
Notifications
You must be signed in to change notification settings - Fork 194
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
Add ReplaceStringProcessor for simple string substitution that doesn't involve regex #4954
Conversation
…t involve regex Signed-off-by: Dinu John <[email protected]>
Signed-off-by: Dinu John <[email protected]>
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.
This is a nice improvement for pipeline authors to perform new mutations.
Thank you for using EventKey
.
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.
The changes look good!
I wonder if we should merge this into the existing substitute_string
processor as a different method. Something like this:
- substitute_string:
entries:
- source: "message"
from: "ab"
to: "ef"
method: "simple" # default is "regex" for existing replace using regex matcher
@JsonPropertyDescription("The string to be substituted for each match of `from`.") | ||
private String to; | ||
|
||
@JsonProperty("substitute_when") |
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.
Should we call it replace_when
here?
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.
good catch
Signed-off-by: Dinu John <[email protected]>
So if I follow you, maybe we don't need a new processor here? Just an option? |
Keeping them decoupled will help with simplicity. |
Yes. That's the idea. It reduces duplicate code and is more extensible if we ever add other string replace methods in the future. But I'm OK with the new processor added here as well. |
Add ReplaceStringProcessor for simple string substitution that doesn't involve regex
Description
Add ReplaceStringProcessor for simple string substitution that doesn't involve regex. It uses java String.replace() method that is highly optimized for simple string replacements
Issues Resolved
Resolves #4953
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.