Description
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.
- With the use of the SED style for the regex pattern, the option to perform a preg_replace and return the result can be achieved.
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.
- The fist null mapping I require is for a 'replace with empty string'. Adding a checkbox beneath the input field will trigger the transformation. This option can be added to any step as it can be passed in the config for the step.
Symphony 6.4 introduces the Null-Coalescing Operator which may resolve this issue, however it requires PHP 8.1.0