Skip to content

Replacing all values in a List<Match> #80

@HKBUSeanTYH

Description

@HKBUSeanTYH

I have a string template like the following for example.

Client Name: {name}
Client ID: {id}

After creating a string format and invoking parseAsList(), I get an Optional of List<Match> and can get the values.

While logging this out, I would like to mask some of the sensitive values, and using a foreach, I replace each match using replaceWith() and assign it back to original string.

However, it only replaces the last match, I am assuming because each match strongly references the original string, but is unaware of replacements made by other Match objects.

Is there any enhancement or workarounds for this?

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