-
Notifications
You must be signed in to change notification settings - Fork 10
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
Enhancement to regex step - Add option for regex replace and null value on input flow #907
Comments
Can you provide an example of when this would be desirable?
Adding this extra functionality will make the step type too complicated and hard to maintain. It should probably be a separate step type. Perhaps something similar to
Though this is pretty well known for developers, dataflows is a tool that should be usable by admins as well. Therefore splitting up the fields into separate fields might be easier for them to understand and enter.
Can you give a detailed example? I'm not sure what you're after and if this is the best approach for your problem. |
Both of these relate to the null value in a field in the input. eg: For the field However when there is a value that has "coursecode":null as in the second record, the return is the input filed value from the step config (eg. The cause of this is here: This would, in turn, be passed to the next step and if that was a web service, for example, probably would not be an expected value. The ability to substitute a null for an empty string will fix this. It may not always be possible to fix the data before it gets to the Dataflow tool. Alternatively, since the issue occurs in What do you think of a new step transform_value_map that would substitute a list of values? The null issue could also be fixed with this.
I think that a mode selector for the "Regex transformer" step (flow_transformer_regex) to choose either Match or Replace in the config would be simple enough. This would be similar to the Compression/Decompression options. However, I am not against having two separate steps. Probably need to rename the flow_transformer_regex to flow_transformer_regex_match.
I agree, separate fields would be better. |
The WHY
Currently the regex transformer performs a return on regex match. Adding the ability to perform a regex replace will make this step flexible for data manipulation.
Currently a null value on the input will be ignored and the "field" parameter is returned. It may be desirable in some case to pass this to the next step. Options added to the flow config to map an alternate value to null, for example, replace with empty string.
The HOW
These are two issues I am facing with a data import I am creating.
Currently '
/<match regex>/
' is supported. This returns the matched strings from the input.If we add the ability to interpret '
s/<search regex>/<replacement>/<flags>
' the step can perform a data manipulation on the input and will return the result.Symphony 6.4 introduces the Null-Coalescing Operator which may resolve this issue, however it requires PHP 8.1.0
The text was updated successfully, but these errors were encountered: