Skip to content

Enhancement to regex step - Add option for regex replace and null value on input flow #907

Open
@glepod

Description

@glepod

The WHY

  1. 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.

  2. 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.

  1. 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.

  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions