Skip to content
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

feat: add mask match #384

Closed
adrienaury opened this issue Jan 15, 2025 · 0 comments · Fixed by #385
Closed

feat: add mask match #384

adrienaury opened this issue Jan 15, 2025 · 0 comments · Fixed by #385

Comments

@adrienaury
Copy link
Member

📝 Description

Introduce a new mask called match to allow transformations on specific parts of a field's value. This mask will use regular expressions to capture subgroups and apply transformations to them individually.

🎯 Problem to Solve

Currently, PIMO lacks the capability to apply transformations to only specific segments of a field's value. This limitation is problematic when a value contains multiple components (e.g., letters and digits in a technical identifier) that require distinct masking strategies.

🔍 Solution Details

The match mask will:

Use a regular expression to capture subgroups within the value.
Apply a list of transformations (masks) to the captured subgroups.
Reconstruct the final value by replacing the matched parts with the transformed results.

Example configuration:

- selector:
    jsonpath: "ID"
  mask:
    match:
      regex: "P(?P<letters>[A-Z]{3})(?P<digits>[0-9]{3})"
      replace:
        letters: # name of the captured group
        - ff1:
            keyFromEnv: ""
            domain: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"  # Transformation for the "letters" group
        digits:
        - ff1:
            keyFromEnv: ""
            domain: "0123456789"  # Transformation for the "digits" group
@adrienaury adrienaury linked a pull request Jan 15, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant