Skip to content

Add --regex-limit #61

@swissspidy

Description

@swissspidy

When using the search-replace command with the --regex option, it uses preg_replace() / preg_replace_callback() to replace all occurrences in a row.

There might be situations where you only want that replacement to happen a certain amount of times (e.g. only once per row).

preg_replace_callback() and preg_replace() have a $limit parameter that could be used for this and defaults to -1 (no limit).

Suggestion: Allow modifying this $limit parameter using a new --regex-limit argument. That should be rather trivial (just pass the value to the function), but needs some testing obviously.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions